
Generated XER Decode Functions
The code generated to decode XML messages is different than that of the other encoding rules. This is because off-the-shelf XML parser software is used to parse the XML documents to be decoded. This software contains a common interface known as the Simple API for XML (or SAX) that is a de-facto standard that is supported by most parsers. ASN1C generates an implementation of the content handler interface defined by this standard. This implementation receives the parsed XML data and uses it to populate the structures generated by the compiler.
The default XML parser used is the EXPAT parser (http://www.expat.org). This is a lightweight, open-source parser that was implemented in C. The C++ SAX interface was added by adapting the headers of the Apache XERCES C++ XML Parser (http://xml.apache.org) to work with the underlying C code. These headers were used to build a common C++ SAX interface across different vendor's SAX interfaces (unlike Java, these interfaces are not all the same). The ASN1C XER SAX C and C++ libraries come with the EXPAT parser as the default parser and also include plug-in interfaces that allow the code to work with the Microsoft XML parser (MSXML), The GNOME libxml2 parser, and the XERCES XML parser. Interfacing to other parsers only requires building an abstraction layer to map the common interface to the vendor's interface.
ASN1C generates code to implement the following methods defined in the SAX content handler interface:
startElement characters endElement
Objective Systems, Inc.55 Dowlin Forge RoadExton, Pennsylvania 19341 http://www.obj-sys.com Phone: (484) 875-9841 Toll-free: (877) 307-6855 (US only) Fax: (484) 875-9830 info@obj-sys.com |