| 1 | 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: |
| 2 | * SAX or DOM? |
| 3 | * provide XML validation for KML documents (mandatory, optional, none)? |
| 4 | * ... |
| 5 | |
| 6 | |
| 7 | There are 3 or 4 XML parsers under our consideration: |
| 8 | * [http://expat.sourceforge.net/ Expat] |
| 9 | * [http://xml.apache.org/xerces-c/index.html Xerces] |
| 10 | * [source:trunk/gdal/port/cpl_minixml.h minixml] |
| 11 | * [http://www.xmlsoft.org/ libXML] |
| 12 | |
| 13 | Here is very [http://xmlbench.sourceforge.net/results/features200303/index.html detailed comparison] (made in 2003) of XML parsing libraries that may be helpful during the analysis. |
| 14 | |
| 15 | |
| 16 | ||'''Feature'''||'''Expat'''||'''Xerces'''||'''minixml'''||'''libXML'''|| |
| 17 | ||''Parser''||[http://en.wikipedia.org/wiki/Simple_API_for_XML SAX]||SAX, [http://en.wikipedia.org/wiki/Document_Object_Model DOM]||DOM||DOM|| |
| 18 | ||''Validating''||no||yes||no||yes (w/o reparsing)|| |
| 19 | ||''Encoding''||UTF-8||UTF-8/16,ASCII,latin1||ASCII/UTF-8||UTF-8/16,ASCII,latin1|| |
| 20 | ||''Library size''||150KB||~4MB||built-in||~1MB|| |
| 21 | ||''Thread safe''||yes||yes||yes||yes|| |
| 22 | ||''Used in GDAL part''||OGDI||GML, ILI||many places||not yet|| |
| 23 | ||''Secure'' ***||yes||no|||||| |
| 24 | ||...||...||...||...||...|| |
| 25 | |
| 26 | '''***''' ''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.'' |
| 27 | |
| 28 | === SAX or DOM === |
| 29 | Which technic should be used for reading the KML files? |
| 30 | * I (Jens) guess SAX would be best, because of the memory consumption of DOM |
| 31 | * SAX is more complex to use in case of KML |