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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

import xml file to visual c++ 1

Status
Not open for further replies.

PsicoMind

Programmer
May 22, 2005
2
PT
hi! i'm doing a program in visual c++. But i have a problem, i need to import things of a xml file and i dunno how!

i already tryed to find in net information but i only find help about visual c++ .net :(

help me please!

thank you
 
You need a simple xml parser. There are various degrees of XML: you could have a simple

xml header
xml definitions

or

xml header
dtd definitions
xml definitions

or

xml header
xlt definitions
xml definitions

If it is just the first form, it is quite easy. The others are more taxing as you need to store the allowable syntax to figure out where your data is. The basics are

1) Skip the header
2) get the tag.
3) if it begins with </, pop the stack. If there is nothing left, exit
4) if it is followed by another attribute with an = sign, save the attribute. Repeat until you get a > or a />
5) if you get a >, push it into a stack.
6) back to step 2 until end of file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top