Search code examples
c++xmlsax

Light weight C++ SAX XML parser


I know of at least three light weight C++ XML parsers: RapidXML, TinyXML and PugiXML. However, all three use a DOM based interface (ie, they build their own in-memory representation of the XML document and then provide an interface to traverse and manipulate it). For most situations that I have to deal with, I much prefer the SAX interface (where the parser just spits out a stream of events like start-of-tag, and the application code is responsible for doing whatever it wants based on those events).

Can anyone recommend a light weight C++ XML library with a SAX interface?

Edit: I should also note the Microsoft XmlLite library, which does use a SAX interface (well, actually a "pull" interface which is possibly even better). Unfortunately, it's ruled out for me at the moment since as far as I know it's closed source and Windows only (please correct me if I'm wrong on this).


Solution

  • I've used expat when I needed to parse XML. It's very light-weight (well, it used to be; it's a while since I've done XML stuff) and does the job.