aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/parser/multiroot/README
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cxx/parser/multiroot/README')
-rw-r--r--examples/cxx/parser/multiroot/README61
1 files changed, 61 insertions, 0 deletions
diff --git a/examples/cxx/parser/multiroot/README b/examples/cxx/parser/multiroot/README
new file mode 100644
index 0000000..817e522
--- /dev/null
+++ b/examples/cxx/parser/multiroot/README
@@ -0,0 +1,61 @@
+This example shows how to handle XML vocabularies with multiple
+root elements using the Embedded C++/Parser mapping.
+
+The example consists of the following files:
+
+protocol.xsd
+ XML Schema which defines a simple bank account protocol with
+ requests such as withdraw and deposit.
+
+balance.xml
+withdraw.xml
+deposit.xml
+ Sample XML instances for the protocol requests.
+
+protocol.hxx
+ C++ types that describe the protocol requests. These are
+ hand-written.
+
+protocol.map
+ Type map. It maps XML Schema types defined in protocol.xsd
+ to the C++ types defined in protocol.hxx.
+
+protocol-pskel.hxx
+protocol-pskel.cxx
+ Parser skeletons generated by XSD/e from protocol.xsd and
+ protocol.map.
+
+protocol-pimpl-mixin.hxx
+protocol-pimpl-mixin.cxx
+
+protocol-pimpl-tiein.hxx
+protocol-pimpl-tiein.cxx
+ Parser implementations (using either mixin or tiein parser
+ reuse style) that construct the custom object model from an
+ XML instance using the types from protocol.hxx. These are
+ hand-written implementations of the parser skeletons defined
+ in protocol-pskel.hxx.
+
+driver.cxx
+ Driver for the example. It implements a custom document parser
+ that determines which request is being parsed and uses the
+ corresponding parser implementation. The document parser
+ intentionally does not support the deposit request to show
+ how to handle unknown documents. The driver first constructs
+ a parser instance from all the individual parsers found in one
+ of protocol-pimpl-*.hxx. In then invokes this parser instance
+ to parse the input file and produce the in-memory object model.
+ Finally, it prints the contents of the object model to STDERR.
+
+To run the example on the sample XML request documents simply
+execute:
+
+$ ./driver balance.xml
+$ ./driver withdraw.xml
+$ ./driver deposit.xml
+
+The example reads from STDIN if input file is not specified:
+
+$ ./driver <balance.xml
+$ ./driver <withdraw.xml
+$ ./driver <deposit.xml