C++/Parser: Stream-Oriented XML Data Binding
The C++/Parser mapping implements a new, high-performance, event-driven XML data binding model which provides parser skeletons for data types defined in XML Schema. In comparison to the traditional, tree-like data binding model, the C++/Parser mapping allows you to handle large XML documents that would not fit into memory, perform stream-oriented processing, or build your own in-memory representations using existing data types. For an introduction to the C++/Parser mapping, refer to the Hello World Example from the C++/Parser Mapping Getting Started Guide.
Based on the static analysis of the schemas, the C++/Parser backend generates highly-optimized, hierarchical state machines that combine validation and even dispatching in a single step. As a result, the C++/Parser mapping-based parsers are 2-10 times faster than general-purpose validating XML parsers while maintaining the lowest memory footprint (if you require maximum performance and lowest footprint, you may also consider XSD/e).
The following figure highlights the advantages of the C++/Parser' mapping in comparison to the traditional architectures:
Features
- Support for C++11 and C++98/03.
- High-performance XML Schema validation in the generated code (perfect parser).
- No dynamic memory allocations during validation (non-recursive parsing).
- Small memory footprint, including heap and stack usage.
- Ready to use parsers for all XML Schema built-in types.
- Automatic generation of sample parser implementations and test drivers.
- Support for Xerces-C++ and Expat as underlying XML parsers.
- Configurable base character type:
char
orwchar_t
. - Configurable application character encoding (UTF-8, ISO-8859-1, UTF-16, UTF-32, local code page).
- Support for XML Schema polymorphism (
xsi:type
and substitution groups). - Support for parsing XML documents with varying root elements.
- Support for C++ mixin style parser reuse.
- Customizable W3C XML Schema namespace to C++ namespace mapping.
- Support for type-less content: mixed content model,
xsd:anyType/xsd:anySimpleType
, andxsd:any/xsd:anyAttribute
. - Automatic morphing of anonymous types into named ones with support for name customization.
- Support for schema importing, inclusion and chameleon-style inclusion.
- Support for the file-per-schema and file-per-type compilation models.
Documentation
C++/Parser Mapping Getting Started Guide | An introduction to the C++/Parser mapping with examples. Also available in PDF and PostScript. |
---|---|
XSD Compiler Command Line Manual | Compiler's command line interface documentation (available compiler options, etc). |
Schema Compilation Checklist | A checklist-like run through the most commonly used XSD command line options. |
C++/Parser Mapping Wiki Page | A resource page for the C++/Parser mapping on Code Synthesis Wiki. |
XSD Wiki Page | A resource page for XSD on Code Synthesis Wiki. |
Support
We provide free, best-effort technical support for XSD via the xsd-users mailing list. Simply send an email to this mailing list with the description of a bug or a problem that you encountered. Please follow the Posting Guidelines to receive a prompt reply.
We also offer priority support on a commercial basis. Visit our support page for more information.
Resources
XSD project page | Source code, build instructions and other information for XSD compiler developers. |
---|---|
XSD contributions | Various third-party contributions to XSD. |
XML Schema Part 0: Primer | An easily approachable description of the XML Schema facilities. It is oriented towards quickly understanding how to create schemas using the W3C XML Schema language. |