blob: 0e2c5b847d80dfc1df0a93643aafd9f5a37f9b35 (
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
|
This example shows how to handle XML Schema polymorphism features such as
xsi:type attributes and substitution groups in the Embedded C++/Serializer
mapping. The case when xsi:type or substitution groups are used on root
elements is covered in the polyroot examples.
The example consists of the following files:
supermen.xsd
XML Schema which describes supermen instance documents.
supermen.hxx
Types that describe the supermen object model in C++. These
are hand-written.
supermen.map
Type map. It maps XML Schema types defined in supermen.xsd to
C++ types defined in supermen.hxx.
supermen-sskel.hxx
supermen-sskel.cxx
Serializer skeletons generated by XSD/e from supermen.xsd and
supermen.map.
supermen-simpl-mixin.hxx
supermen-simpl-mixin.cxx
supermen-simpl-tiein.hxx
supermen-simpl-tiein.cxx
Serializer implementations (using either mixin or tiein parser
reuse style) that serialize the custom in-memory object model to
XML. These are hand-written implementations of the serializer
skeletons defined in supermen-sskel.hxx.
driver.cxx
Driver for the example. It first constructs a sample object model
using the types from supermen.hxx. It then creates a serializer
instance using all the individual serializers found in one of
supermen-simpl-*.hxx. Finally, it invokes this serializer instance
to serialize the sample object model to an XML document which is
printed to STDOUT.
To run the example simply execute:
$ ./driver
|