wiki:XmlParser

Version 1 (modified by Didge, 17 years ago) ( diff )

created from old data

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)?
  • ...

There are 3 or 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.

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
Note: See TracWiki for help on using the wiki.