summaryrefslogtreecommitdiff
path: root/xsd-examples/cxx/parser/library/README
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-examples/cxx/parser/library/README')
-rw-r--r--xsd-examples/cxx/parser/library/README61
1 files changed, 61 insertions, 0 deletions
diff --git a/xsd-examples/cxx/parser/library/README b/xsd-examples/cxx/parser/library/README
new file mode 100644
index 0000000..c0af7fc
--- /dev/null
+++ b/xsd-examples/cxx/parser/library/README
@@ -0,0 +1,61 @@
+This example shows how to use the C++/Parser mapping to construct
+a custom in-memory object model from XML instance documents.
+
+The example consists of the following files:
+
+library.xsd
+ XML Schema which describes a library of books.
+
+library.xml
+ Sample XML instance document.
+
+library.hxx
+ Types that describe a library of books in C++. These are
+ hand-written.
+
+library.map
+ Type map. It maps XML Schema types defined in library.xsd
+ to the C++ types defined in library.hxx.
+
+library-pskel.hxx
+library-pskel.ixx
+library-pskel.cxx
+ Parser skeletons generated by the XSD compiler from library.xsd and
+ library.map using the following command line:
+
+ xsd cxx-parser --type-map=library.map library.xsd
+
+ Or if using Expat instead of Xerces-C++ as the underlying XML parser:
+
+ xsd cxx-parser --xml-parser=expat --type-map=library.map library.xsd
+
+library-pimpl.hxx
+library-pimpl.cxx
+ Parser implementations that construct the custom in-memory
+ object model from an XML instance using the types from
+ library.hxx. These are hand-written implementations of
+ the parser skeletons defined in library-pskel.hxx.
+
+driver.cxx
+ Driver for the example. It first constructs a parser
+ instance from all the individual parsers found in
+ library-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
+ in-memory object model to STDERR.
+
+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++ -c library-pskel.cxx
+c++ -c library-pimpl.cxx
+c++ -c driver.cxx
+c++ -o driver driver.o library-pskel.o library-pimpl.o -lxerces-c
+
+Or if using Expat as the underlying XML parser:
+
+c++ -o driver driver.o library-pskel.o library-pimpl.o -lexpat
+
+To run the example on the sample XML instance document execute:
+
+./driver library.xml