Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import data from an XML file without setting a reference to MSX

Status
Not open for further replies.

espositophp

Programmer
Sep 30, 2003
31
Hello. I have a problem I would like you to help me sort out. It deals with the management of XML files through Visual Basic.

First of all, a premise. So far I have been programming my software using VB5 instead of VB6 and what I really like about it is the fact that you don't even need to create a setup application if the final user of your program has got Windows 98 or later version.

This is thanks to the fact that when you install Windows 98 you also install all the DLLs needed by VB5 programs (MSVBVM50.DLL and OLEAUT32.DLL) since they are included in the operating system. Considering these two libraries are the only ones needed by all programs developed in VB5 (provided that you don't use OCXs or third party DLLs), it is enough to distribute the .EXE file to make your software run on a computer equipped with Windows 98 or later version. Try to believe.

Unfortunately, this is not true if you consider an application developed in VB6 in that the version of OLEAUT32.DLL needed by VB6 programs is more recent that the one you can find in Windows 98, so you will need to provide the final user with an installation program that can replace the older library with the newer one. That's why I think that using VB6 may be counter-productive from this point of view.

The aim of my premise is, I'd like to sort out my problem with XML using Visual Basic 5.0.

Now, I know perfectly how to create an XML file with VB5 and convert a database to this format. It is enough to create a text file with an .xml extension using a statement such as

Open "myfile.xml" For Output As #1

and loop through the records in the database with a Do While statement, exporting the records to the XML file with the Print method (e.g. Print #1, record(i)).

Unfortunately, I did not succeed in doing the contrary, i.e. importing the data from an XML file without setting a reference to the MSXML library. The reason why I'd like to achieve this target is, I don't want my software to be browser dependent. As you know, the MS library is installed together with Internet Explorer 5.0 or later version.

To sum up, what I'd like to do is parse the XML file through pure VB5 code, extract the data from the nodes and import such data into one or more textboxes. By the way, the structure of the XML file is known, so you can refer to specific nodes even though you don't know how many records the XML database contains.

Any help is welcome. TIA

Pasquale Esposito
Perugia - Italy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top