summaryrefslogtreecommitdiff
path: root/xsd-examples/cxx/tree/custom/mixed/README
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-examples/cxx/tree/custom/mixed/README')
-rw-r--r--xsd-examples/cxx/tree/custom/mixed/README30
1 files changed, 24 insertions, 6 deletions
diff --git a/xsd-examples/cxx/tree/custom/mixed/README b/xsd-examples/cxx/tree/custom/mixed/README
index 7b56812..8f7bd13 100644
--- a/xsd-examples/cxx/tree/custom/mixed/README
+++ b/xsd-examples/cxx/tree/custom/mixed/README
@@ -1,6 +1,6 @@
This example shows how to use type customization to parse and serialize
-mixed content. The example achieves this by customizing the type with
-the mixed content model to include a DOM document that stores the data
+mixed content. The example achieves this by customizing the type with
+the mixed content model to include a DOM document that stores the data
as a raw XML representation. The customized type also provides its own
parsing constructor and serialization operator where the mixed content
is extracted from and inserted back to DOM, respectively. The use of
@@ -28,8 +28,15 @@ people.cxx
C++ types that represent the given vocabulary, a set of parsing
functions that convert XML instance documents to a tree-like in-memory
object model, and a set of serialization functions that convert the
- object model back to XML. These are generated by XSD from people.xsd
- with the --custom-type option in order to customize the bio type.
+ object model back to XML.
+
+ These files are generated by the XSD compiler from people.xsd using the
+ following command line:
+
+ xsd cxx-tree --generate-serialization --custom-type bio=/bio_base \
+ --hxx-epilogue '#include "people-custom.hxx"' people.xsd
+
+ The --custom-type option is used to customize the bio type.
people-custom.hxx
Header file which defines our own bio class by inheriting from the
@@ -45,6 +52,17 @@ driver.cxx
the data to STDERR, including the bio information converted to text.
Finally, the driver serializes the object model back to XML.
-To run the example on the sample XML instance document simply execute:
+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 people.cxx
+c++ -DXSD_CXX11 -c people-custom.cxx
+c++ -DXSD_CXX11 -c driver.cxx
+c++ -o driver driver.o people.o people-custom.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 people.xml
+./driver people.xml