blob: addce8379e8f4e13bf50c6c9de58092ce467097f (plain
This example shows how to map user-defined XML Schema types to custom C++
classes. It presents the complex case where the customized types are
inherited from in the same schema. For the simple case see the contacts
example. For more information on the C++/Tree mapping customization see
the C++/Tree Mapping Customization Guide.
The example consists of the following files:
XML Schema definition for a simple people database.
Sample XML instance document.
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 are generated by XSD from people.xsd with the
--custom-type option in order to to customize the person, superman,
and batman types. Generation of the people-fwd.hxx forward declaration
file is requested with the --generate-forward option.
Header file which forward-declares our own person, superman, and batman
as class templates. It is included at the beginning of people-fwd.hxx
using the --fwd-prologue option.
Header file which defines our own person, superman, and batman class
templates by inheriting from the generated person_base, superman_base,
and batman_base. It is included at the beginning of people.hxx using
the --hxx-prologue option.
Source file which contains the implementations and instantiations of
our person, superman, and batman class templates.
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 database to STDERR.
To run the example on the sample XML instance document simply execute:
$ ./driver people.xml