summaryrefslogtreecommitdiff
path: root/xsd-examples/cxx/tree/custom/contacts/README
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-examples/cxx/tree/custom/contacts/README')
-rw-r--r--xsd-examples/cxx/tree/custom/contacts/README55
1 files changed, 55 insertions, 0 deletions
diff --git a/xsd-examples/cxx/tree/custom/contacts/README b/xsd-examples/cxx/tree/custom/contacts/README
new file mode 100644
index 0000000..b2f95eb
--- /dev/null
+++ b/xsd-examples/cxx/tree/custom/contacts/README
@@ -0,0 +1,55 @@
+This example shows how to map a user-defined XML Schema type to a custom
+C++ class. It presents the simple case where the customized type is not
+used as a base in the same schema. For the complex case see the taxonomy
+example. For more information on the C++/Tree mapping customization see
+the C++/Tree Mapping Customization Guide[1].
+
+[1] http://wiki.codesynthesis.com/Tree/Customization_guide
+
+The example consists of the following files:
+
+contacts.xsd
+ XML Schema definition for a simple contacts database.
+
+contacts.xml
+ Sample XML instance document.
+
+contacts.hxx
+contacts.ixx
+contacts.cxx
+ C++ types that represent the given vocabulary and a set of parsing
+ functions that convert XML instance documents to a tree-like in-memory
+ object model.
+
+ These files are generated by the XSD compiler from contacts.xsd using the
+ following command line:
+
+ xsd cxx-tree --custom-type contact=/contact_base \
+ --hxx-epilogue '#include "contacts-custom.hxx"' contacts.xsd
+
+ The --custom-type option is used to customize the contact type.
+
+contacts-custom.hxx
+ Header file which defines our own contact class by inheriting from the
+ generated contact_base. It is included at the end of contacts.hxx using
+ the --hxx-epilogue option.
+
+contacts-custom.cxx
+ Source file which contains the implementation of our contact class.
+
+driver.cxx
+ Driver for the example. It first calls one of the parsing functions
+ that constructs the object model from the input file. It then prints
+ the contacts 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 contacts.cxx
+c++ -c contacts-custom.cxx
+c++ -c driver.cxx
+c++ -o driver driver.o contacts.o contacts-custom.o -lxerces-c
+
+To run the example on the sample XML instance document execute:
+
+./driver contacts.xml