TOC PREV NEXT INDEX


SAX Based Decode Methods


If -sax is specified on the XBinder command-line, the code generated to decode XML messages uses off-the-shelf XML parser software 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. XBinder 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. XBinder generates C++ SAX handler classes within the generated type class for a given XML schema type. The methods within these classes are called from the SAX interface of the XML parser framework to decode XML data into the generated typed data structures. The interface was designed to be generic so that other XML parsers could be easily substituted.
In addition to Expat, interfaces to the following other C/C++ XML parsers are also available:
1. GNOME LibXML2 parser (http://xmlsoft.org)
2. XERCES C++ parser (http://apache.org)
3. A custom micro-SAX parser. This is a bare-boned XML parser targeted at small footprint applications.
Interfacing to other parsers requires building an abstraction layer to map the common interface to the vendor's interface.
XBinder generates code to implement the following SAX content handler methods:

startElement

characters

endElement


The interface defines other methods that can be implemented as well, but these are sufficient to decode XML encoded data.


Copyright © Objective Systems 2002-2008
This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included.

Objective Systems, Inc.

55 Dowlin Forge Road
Exton, 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

TOC PREV NEXT INDEX