blob: 0121f9acaa2d2038f86cf22328351d32e7b55a7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
This example is a minimal serializer implementation that is
intended to work without STL, iostream, or C++ exceptions.
The example consists of the following files:
people.xsd
XML Schema which describes a collection of person
records.
people.hxx
Simple C++ types that corresponds to the XML Schema
types in people.xsd. These are hand-written.
people.map
Type map. It maps XML Schema types defined in
people.xsd to C++ types defined in people.hxx.
people-sskel.hxx
people-sskel.ixx
people-sskel.cxx
Serializer skeletons generated by XSD/e from people.xsd
and people.map. The --no-stl and --no-iostream options
were used to produce these files.
people-simpl-mixin.hxx
people-simpl-tiein.hxx
Serializer implementations (using either mixin or tiein
parser reuse style) that serializes the custom in-memory
object model defined in people.hxx to XML. These are hand-
written implementations of the parser skeletons defined
in people-sskel.hxx.
driver.cxx
Driver for the example. It first constructs a sample
object model using the types from people.hxx. It then
creates a serializer instance using the serializer
implementation mentioned above and a couple of predefined
serializers for the XML Schema built-in types. Finally, it
invokes this serializer instance to serialize the sample
object model to an XML document which is printed to STDOUT.
It also shows how to handle serialization and validation
errors using error codes.
To run the example simply execute:
$ ./driver
|