Computing.Net > Forums > Programming > XML n VB 6

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

XML n VB 6

Reply to Message Icon

Original Message
Name: Fel
Date: August 22, 2005 at 02:01:58 Pacific
Subject: XML n VB 6
OS: Windows XP sp 1
CPU/Ram: Athlon 64 2800+ / V-Gen 5
Comment:

hi all
please help.
how do we open a .xml file using vb6?
i need to grab some data from the file and print it.

regards

Athlon 64 2800+ @ 2.63 Ghz Stock Cooling
Timings:2-3-2-5
V-Gen 512MB pc3200
DFI Lanparty UT NF3
Abit R9550 VGuru XTurbo
525Mhz/300Mhz


Report Offensive Message For Removal


Response Number 1
Name: wizard-fred
Date: August 22, 2005 at 02:34:55 Pacific
Reply: (edit)

An XML file is a specially formatted text file. You open it like any other text file. You then read and parse the data until you find the data label(s) containing the desired data elements. Then extract the required elements and format and print it. You will need to find the XML data layout for the type of XML file you are reading.


Report Offensive Follow Up For Removal

Response Number 2
Name: Chi Happens
Date: August 22, 2005 at 04:04:47 Pacific
Reply: (edit)

I might be able to find my XML dll that I created in VB6...let me look and I will post it if I find it.

Chi

They mostly come at night...mostly.


Report Offensive Follow Up For Removal

Response Number 3
Name: Chi Happens
Date: August 22, 2005 at 04:12:34 Pacific
Reply: (edit)

You can get my source code as well as the compiled DLL here:

http://www.evolutionsoftwarellc.com/downloads/XML.rar

Enjoy
Chi

They mostly come at night...mostly.


Report Offensive Follow Up For Removal

Response Number 4
Name: Fel
Date: August 22, 2005 at 07:23:08 Pacific
Reply: (edit)

wow, thanx chi.
i have downloaded it, but when i run it, there is a message box "compile error, cannot find project or library". then, i manually browse for .dll file, but it still happens. hmm, what am i missing here?
fred, how do we find the data layout?

Athlon 64 2800+ @ 2.63 Ghz Stock Cooling
Timings:2-3-2-5
V-Gen 512MB pc3200
DFI Lanparty UT NF3
Abit R9550 VGuru XTurbo
525Mhz/300Mhz


Report Offensive Follow Up For Removal

Response Number 5
Name: wizard-fred
Date: August 22, 2005 at 09:02:50 Pacific
Reply: (edit)

Accompanying an XML file is a DTD (Data Type Definition) file. I think you could make a DLL like chi that reads The DTD so that it could then extract the data from the XML. In my case I just found the labels that I wanted and extracted the data directly. The writer or specifier of the XML will usually post the DTD somewhere near the programming of the original application. A long way to find the fields is to read the XML file to find the structure of it. Note that you can have repeated records in a file as well as repeated fields in an a record. You may have records without certain fields. Essentially you might consider an XML file as a form of database. In my case it was a 17MB XML file from which I extracted 216 database files containing slightly more than 29,000 records I wanted.

In your case you may be looking at an XML file that has only one record. Look at the file and inspect it. That should determine your plan of attack. I am probably using a more primitive method (compiled BASIC in a DOS Window). It gets the job done on resource limited machines.


Report Offensive Follow Up For Removal


Response Number 6
Name: Chi Happens
Date: August 22, 2005 at 09:39:13 Pacific
Reply: (edit)

you need to either register the dll via regsvr32.exe or add the project to your current vb project.

Chi

They mostly come at night...mostly.


Report Offensive Follow Up For Removal

Response Number 7
Name: Fel
Date: August 22, 2005 at 10:40:04 Pacific
Reply: (edit)

hmm, come to think of it, i will use C/CPP to read it, and VB as the interface, it will be a lot easier, thanx fred.

i have created a simple program to read the xml, and it is easier for me to make a C program to read an XML file and extract the data i wanted.
i have another question, but it is OOT, so i will post it on different subject.


Athlon 64 2800+ @ 2.63 Ghz Stock Cooling
Timings:2-3-2-5
V-Gen 512MB pc3200
DFI Lanparty UT NF3
Abit R9550 VGuru XTurbo
525Mhz/300Mhz


Report Offensive Follow Up For Removal

Response Number 8
Name: sudheer4unu
Date: September 15, 2005 at 01:09:17 Pacific
Reply: (edit)

Hello to all,
I Am in need of source code in VB of reading selected data from XML file located in some URL .So kindly hlp me to get out of this


Report Offensive Follow Up For Removal






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software