> Does anyone on the list have experience using an XML parser
> with C++? If so, can you recommend a decent set of parser tools?

I have been using the Xerces-C++ parser for an application, and it has been
more than adequate.

http://xml.apache.org/xerces-c/index.html

I have also used expat.

http://www.jclark.com/xml/expat.html

The Xerces-C++ parser seems pretty complete. You can parse documents using
either the SAX or DOM interfaces. (When using SAX, you provide callback(s)
for XML element beginning and endings. The DOM interface builds a tree in
memory of the entire document contents, which you can then "walk.") My
favorite thing about Xerces-C++ is its support of XML Schema. You can
provide the parser with an XML Schema file (which is like a DTD, only in XML
format) and the parser will notify you if the document doesn't conform.

Expat seems to be a more minimalist implementation. It is not a "validating"
parser. It is written in C, and offers a SAX-style interface.

If pure speed is important to you...

(I am not saying that it should be. I only bring it up because it has been
mentioned in this group recently.)

you might want to look at the internal character representations used by the
parsers that you consider. XML files can be encoded with 8 or 16 bit
characters. The Xerces-C++ parser interface uses 16 bit characters,
regardless of the encoding of the document. If I remember correctly, expat
uses 8 bit characters. If all of your XML files are encoded in 8 bits, you
might be able to realize a small performance gain by using a parser that
takes advantage of this fact.

Of course, if speed is that important, you could probably select a better
format than XML.

Jeremy Furtek
Delphi Research
mailto:[EMAIL PROTECTED]



Reply via email to