blob: 6490c3eb534b5b8ac226c75a0e5de7c4f95cb5ac (
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
48
|
This example shows how to use the Embedded C++/Hybrid mapping to parse
XML documents into an in-memory object model, modify this object model,
and serialize it back to XML.
The example consists of the following files:
library.xsd
XML Schema which describes a library of books.
library.xml
Sample XML instance document.
library.hxx
library.cxx
library-pskel.hxx
library-pskel.cxx
library-pimpl.hxx
library-pimpl.cxx
library-pskel.hxx
library-pskel.cxx
library-pimpl.hxx
library-pimpl.cxx
Object model (the first pair of files), parser skeletons (the
second pair), parser implementations (the third pair), serializer
skeletons (the fourth pair), and serializer implementations (the
fifth pair). These files are generated by the XSD/e compiler from
library.xsd. The --generate-parser, --generate-serializer, and
--generate-aggregate options were used to request the generation of
the parsing and serialization code. The --omit-default-attributes
option was used to omit the 'available' attributes with the default
value from the serialized XML documents.
driver.cxx
Driver for the example. It first calls the parser that constructs
the object model from the input XML file. It then prints the content
of the object model to STDERR. Finally, the driver modifies the
object model and calls the serializer to serialize it back to XML.
To run the example on the sample XML instance document simply execute:
$ ./driver library.xml
The example reads from STDIN if input file is not specified:
$ ./driver <library.xml
|