How to import data from an XML file
[Originally posted by esposito]
Hello, everybody. 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
Perugia - Italy
Re:How to import data from an XML file
[Originally posted by FreeVBCode.com]
Have you seen these?
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center