views:

104

answers:

3

Hey I'm looking for an XML parser for C/C++, just a parser which I give a string as an argument and it returns me a parsed document represented by a class/struct.

The problem is that I am compiling it for the ARM9 processor and I need really just simple code no ./configure and stuff like that and no specific Makefile, just some files which will work with every compiler without dependencies on other libraries.

Please help me, I'm really desperate.

A: 

TinyXML is nice and lightweight:

http://sourceforge.net/projects/tinyxml

But this has been asked many times (although perhaps not quite with your flavour):

http://stackoverflow.com/search?q=c%2B%2B+xml+parser

Adam Bowen
Thank you.By the way, do you know how do I parse a string and not a file?
Tamir
From the docs: "C++ style input isbased on std::istream" - pass it a `std::stringstream` instead of an `std::ifstream`
MSalters
IIRC you can also call the Parse method on a TiXmlDocument.
Adam Bowen
The version of TinyXML I used some time back had a bug where an empty child tag like this: '<tag/>' that had the same name as it's parent, closed the parent tag as well. Might be fixed now.
Skizz
A: 

There are two widely used ones that I know of: Xerxes and libXML. Might want to look into whether either of them has a lightweight "embedded" footprint version.

vicatcu
+1  A: 

I've found ezxml to work quite well for my purposes. Certainly fits the simple requirement. I use it to do the parsing and fill the internal structures actually used.

Ioan