I've been looking for an XML library to use, not for any project in specific because I have many ideas for projects that could use an XML library. I want to know what other people use and how they worked for you.
XML Parser
tinyxml, I havent moved to tinyxml 2.0 yet, but I havent had any problems with the original.
I used Xerces on C++.
http://xerces.apache.org/xerces-c/
It was extremely robust, and also contains a SAX parser (which is more memory efficient than DOM) .
It also has validator schemas, and just about anything you might ever want from XML.
The downside, was that it takes a long time to compile, and produces a huge binary.
But for enterprise level XML it's the best.
That was a couple of years ago. Since then, I've moved to jSon wherever I can, and have never looked back. If you have the option to avoid XML, you should.
For C++, I use both TinyXML (pre-v2) and pugixml. I find Pugixml to be faster in reading, writing, and typing, but writing to a string is less intuitive
(you have to derive from the Writer class). I would say TinyXml's class has an intuitive class hierarchy, but there's a bit more typing, especially in v1, and dealing with large XML files is slow.
Choosing the right XML parsing library depends upon what you need to do.
Xerces will do everything: validation, SAX-style parsing, etc. and is extremely robust; however, it is really heavy-weight and kind of a pain in the ass all around. If you don't have advanced needs: if you don't need to parse huge XML files;if you are not worried about absolute XML standard conformance and so forth; then don't use Xerces or anything like Xerces.
If you just need to parse a few modestly-sized XML files for a game project, use TinyXML and you will be fine.
Also I have a question regarding TinyXML ... everyone is recommending v1, which I would too, but I know in my case it's really based on the fact that I started using v1 and never had any problem with it so I saw no reason to switch and have to learn a new interface or possibly have specific v2-related problems. Is this why everyone is recommending TinyXML v1? Or have some people actually tried TinyXML v2 and had problems?
I'm in love with pugixml. It's lightning fast, supports Unicode, XPath 1.0, very lightweight, has both a header-only version and a header+source version, etc.
Of course, I'm assuming you're using C++, as you didn't say what language you're using.
I use RapidXml in my projects - it's a fast, easy to use, 4 files, header only API, thus can be integrated quite easily. -> http://rapidxml.sourceforge.net/ .
Of course, I'm assuming you're using C++, as you didn't say what language you're using.
It'd have to be C++ as it's pretty much the only mainstream language out there that doesn't have an xml parser as part of it's standard library :)
Also I have a question regarding TinyXML ... everyone is recommending v1, which I would too, but I know in my case it's really based on the fact that I started using v1 and never had any problem with it so I saw no reason to switch and have to learn a new interface or possibly have specific v2-related problems. Is this why everyone is recommending TinyXML v1? Or have some people actually tried TinyXML v2 and had problems?
Yeah, that's prettily much why I stayed with v1.