Hi,
I'm looking for an "easy" way to parse a xml file to a proper structure.
The xml looks like this
What shall I use? Does anybody has some example-code to share or some good links/book-references?
thx for any reply
-fe
Hi,
I'm looking for an "easy" way to parse a xml file to a proper structure.
The xml looks like this
What shall I use? Does anybody has some example-code to share or some good links/book-references?
thx for any reply
-fe
You didn't mention which library you are going to use.
For libxml2, samples at
http://www.xmlsoft.org/examples/index.html
For Apache Xerces C++, samples at
http://xml.apache.org/xerces-c/samples.html
Thats because I didn't use any but I want to and because there are some I wanted to ask "what is a good lib to go for" ![]()
What do u suggest and why?
thx
-fe
Personally I'm more fond of OO programming so I would go for Xerces, and I believe its API is easier to understand (and write), but libxml is more widely used in Open-Source community (mostly GTK-based programs).
You could always write your own
I did, in about 2600 lines of code. But I had no choice, I needed something that no other library wanted to give me, the ability to parse chunks of XML and piece them together into a final parse tree structure. That was plenty of fun...doesn't completed support the XML definition (doesn't support document type definition) but it works for simple stuff....
The answer to your problem is SAX API.
SAX is low level parser you can use to parse
XML and put into your data structure.
Also, Java is better for this project than C, but
that is just my opinion.