Lightweight C ++ SAX XML Parser

I know at least three C ++ XML parsers: RapidXML , TinyXML, and PugiXML . However, all three use a DOM-based interface (i.e., they create their own representation of the XML document in memory, and then provide an interface for moving and managing it). For most situations that I have to deal with, I prefer the SAX interface (where the parser simply splashes out a stream of events, such as the beginning of the tag, and the application code is responsible for what it wants based on these events).

Can someone recommend a lightweight C ++ XML library with SAX?

Edit: You should also mention the Microsoft XmlLite library, which uses the SAX interface (well, actually, the “pull” interface, which is perhaps even better). Unfortunately, at the moment this excludes me, because I know that this is a closed source and only Windows (please correct me if I am wrong).

+7
source share
3 answers

I used expat when I needed to parse XML. It is very light (well, that was before, since I did the XML material) and does the job.

+5
source

you can try http://die-xml.googlecode.com/ . It seems very small and easy to use.

this is the recently created C ++ 0x XML SAX parser open source and the author agrees with the reviews

it parses the input stream and generates events on callbacks compatible with std :: function

the stack machine uses state machines as a backend, and some events (start tag and text nodes) use iterators to minimize buffering, making it fairly easy.

+5
source

PugiXML and RapidXML do not have DOM compatible interfaces. These APIs have severe limitations on functionality and compliance. You might want to explore VTD-XML, which is significantly more advanced than DOM or SAX / Pull

0
source

All Articles