blob: ac7e7f06fa4451d024a5717661546d776df133c7 (plain
This example shows how to perform stream-oriented, partially in-memory
XML processing using the C++/Tree mapping. With the partially in-memory
parsing and serialization only a part of the object model is in memory at
any given time. With this approach we can process parts of the document
as they become available as well as handle documents that are too large
to fit into memory.
The example consists of the following files:
XML Schema which describes a simple object position vocabulary. The
position is represented as a potentially large series of latitude and
Sample object position document.
C++ types that represent the position vocabulary as well as parsing
and serialization functions. These are generated by XSD from
Stream-oriented DOM parser implementation that is built on top of the
Xerces-C++ SAX2 parser in the progressive parsing mode. This parser
allows us to parse an XML document as a series of DOM fragments.
Stream-oriented DOM serializer implementation that allows us to
serialize an XML Document as a series of object model fragments.
Driver for the example. It first parses the input file into a series
of DOM fragments which are then parsed into the object model fragments.
The driver prints the information from the document as it becomes
available. The driver then creates a new XML document (out.xml) by
creating and serializing a series of object model fragments.
To run the example simply execute:
$ ./driver position.xml
The serialization results are written to the out.xml file.