wiki:XmlParser

The very first task is to choose XML parser that will be used as a foundation of the KML driver. There are many questions that have to be answered:

  • SAX or DOM?
  • provide XML validation for KML documents (mandatory, optional, none)?
  • etc.

There are 4 XML parsers under our consideration:

Here is very detailed comparison (made in 2003) of XML parsing libraries that may be helpful during the analysis.

FeatureExpatXercesminixmllibXML
ParserSAXSAX, DOMDOMDOM
Validatingnoyesnoyes (w/o reparsing)
EncodingUTF-8UTF-8/16,ASCII,latin1ASCII/UTF-8UTF-8/16,ASCII,latin1
Library size150KB~4MBbuilt-in~1MB
Thread safeyesyesyesyes
Used in GDAL partOGDIGML, ILImany placesnot yet
Secure *yesno
...............

* Google avoids Xerces because it considers it to be insecure in the face of hostile XML documents, but considers Expat safe. Presumably based on an indepth security review.

Speed

Speed comparison of different XML parsers

SAX or DOM

Which technic should be used for reading the KML files?

  • I (Jens) guess SAX would be best, because of the memory consumption of DOM
  • SAX is more complex to use in case of KML

Final

I will use expat, because of the decision for SAX, the speed and it is more secure than Xerces.

Last modified 17 years ago Last modified on Jun 24, 2007, 9:10:34 PM
Note: See TracWiki for help on using the wiki.