Jump to content
  • Advertisement
Sign in to follow this  
samgj

XML Parser

This topic is 2200 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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.

Edited by shuma-gorath

Share this post


Link to post
Share on other sites

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?

Edited by jwezorek

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites


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 :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!