Xml Parser, C++

Started by
24 comments, last by ChaosEngine 7 years, 8 months ago

What have you used to parse XML files in C++?

Advertisement

I've used TinyXML and RapidXML in the past. They get the job done.

I second TinyXML. I use it everytime.

One more vote on RapidXML. It's really really simple to use.

I've used Xerces in the past -- I didn't spend any significant amount of time researching or weighing its pros and cons versus competitors. The impression I get is that Xerces is probably the most conformant (its an Apache project, and is a validating parser) and is likely the most heavyweight library, for good and for ill. The other options mentioned here will likely get the job done in any case, and with conformant input themselves, even if they don't accept all conformant XML (that is, my impression is that they accept a pure subset of valid XML that differs in little-used ways, or ways not relevant to their use cases -- and that they do not accept invalid XML).

throw table_exception("(? ???)? ? ???");

Libxml2 -- hey, it's what I've used. You asked.

Stephen M. Webb
Professional Free Software Developer

I wrote a partial xml parser (for Tiled's tmx files) with std::regex yesterday, lol. Knowing what fields are going to be (or should be) present makes it a lot easier to work on.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

What have you used to parse XML files in C++?

Exactly what do you want to do with these parsed XML files?

If you just want to read the XML into a data structure, TinyXML is simple and lightweight.

But it doesn't do schema validation or XSL transforms.

Libxml and Xerces will (I think, been a while since I used them), but it's not as easy to use.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight

+1 for TinyXML

http://pugixml.org/ is a very nice one and my favourite, especially since it's just 2 headers and a source so it can be dropped right into project's source tree, zero hassle with building, linking. It has extremely friendly API in same naming style as C++ std lib does.

This topic is closed to new replies.

Advertisement