After choosing your programming strategy (SAX, DOM, XMLPULL, etc.), the next step in writing an XML application is to select a parser. There is no reason to write your own parser when so many excellent ones already exist. Some qualities to look for are API support, speed and efficiency, and robustness. Table 10-1 lists some of the best, although there are so many out there today that I could not hope to list them all.
Name |
Language |
APIs |
Web Site |
---|---|---|---|
Expat |
C, Perl (via XML::Parser module), Python (via xml.parsers.expat) |
Low-level stream parser |
http://www.jclark.com/xml/expat.html |
XP |
Java |
Low-level stream parser |
http://www.jclark.com/xml/xp/ |
libxml2 |
C++, Perl (via XML::LibXML module) |
DTD validation, SAX (minimal), DOM2 (core, need gdome2 library for the API), XPath, Relax NG, XML Schemas (data types) |
http://xmlsoft.org/ |
Xerces2 |
Java |
DTD validation, SAX2 (core, extension), DOM2 (core, events, traversal), DOM3 (experimental core), Xerces Native Interface (XNI), XML Schema (structures and data types), Java APIs for XML Parsing (JAXP) |
http://xml.apache.org/ |
Xerces |
Java, C++, Perl (via XML::Xerces module) |
DTD validation, SAX2 (core, extension), DOM2 (core, events, traversal), DOM3 (partial core), Xerces Native Interface (XNI), XML Schema (structures and data types) |
http://xml.apache.org/ |
Java API for XML Parsing (JAXP) |
Java |
DTD validation, DOM, SAX, XSLT, XML Schema |
http://java.sun.com/xml/jaxp/ |
JDOM |
Java |
XPath, JDOM, an alternative to SAX and DOM |
http://www.jdom.org |
Microsoft XML Parser |
Java, C++, C# |
DTD validation, SAX, DOM, XSLT, XML Schema, XPath, XML Schema definition language (XSD), Schema Object Model (SOM) |
http://msdn.microsoft.com/xml/ |
PyXML |
Python |
DTD validation, SAX2, DOM2, PullDOM |
http://pyxml.sourceforge.net/ |
Xparse |
JavaScript |
Basic stream parser |
http://www.jeremie.com/Dev/XML/ |