summaryrefslogtreecommitdiff
path: root/xsd-examples/cxx/tree/streaming/README
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-examples/cxx/tree/streaming/README')
-rw-r--r--xsd-examples/cxx/tree/streaming/README69
1 files changed, 69 insertions, 0 deletions
diff --git a/xsd-examples/cxx/tree/streaming/README b/xsd-examples/cxx/tree/streaming/README
new file mode 100644
index 0000000..23d3a7f
--- /dev/null
+++ b/xsd-examples/cxx/tree/streaming/README
@@ -0,0 +1,69 @@
+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:
+
+position.xsd
+ XML Schema which describes a simple object position vocabulary. The
+ position is represented as a potentially large series of latitude and
+ longitude measurements.
+
+position.xml
+ Sample object position document.
+
+position.hxx
+position.cxx
+ C++ types that represent the position vocabulary as well as parsing
+ and serialization functions.
+
+ These files are generated by the XSD compiler from position.xsd using
+ the following command line:
+
+ xsd cxx-tree --generate-serialization position.xsd
+
+parser.hxx
+parser.cxx
+ 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.
+
+serializer.hxx
+serializer.cxx
+ Stream-oriented DOM serializer implementation that allows us to
+ serialize an XML Document as a series of object model fragments.
+
+grammar-input-stream.hxx
+grammar-input-stream.cxx
+ Input stream implementation with the special-purpose schema grammar
+ decompression algorithm. It is used internally by the streaming parser.
+
+driver.cxx
+ Driver for the example. It 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.
+ It also serializes the object model fragments into a new XML document
+ (out.xml).
+
+To compile and link the example manually from the command line we can use
+the following commands (replace 'c++' with your C++ compiler name):
+
+c++ -DXSD_CXX11 -c position.cxx
+c++ -DXSD_CXX11 -c parser.cxx
+c++ -DXSD_CXX11 -c serializer.cxx
+c++ -DXSD_CXX11 -c grammar-input-stream.cxx
+c++ -DXSD_CXX11 -c driver.cxx
+c++ -o driver driver.o position.o parser.o serializer.o \
+ grammar-input-stream.o -lxerces-c
+
+Note that we need to define the XSD_CXX11 preprocessor macro since the
+source code includes libxsd headers directly.
+
+To run the example on the sample XML instance document execute:
+
+./driver position.xml
+
+The serialization results are written to the out.xml file.