blob: d4515090e6745c3a524578f0cc5c539c98af2c7f (
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
|
This example shows how to use the optional wildcard mapping provided
by C++/Tree to parse, access, modify, and serialize the XML data
matched by XML Schema wildcards (any and anyAttribute). For an
alternative approach that employes type customization see the
custom/wildcard example.
The example consists of the following files:
email.xsd
XML Schema which describes a simple email format with the
extensible envelope type.
email.xml
Sample email message.
email.hxx
email.ixx
email.cxx
C++ types that represent the given vocabulary, a set of parsing
functions that convert XML instance documents to a tree-like in-memory
object model, and a set of serialization functions that convert the
object model back to XML. These are generated by XSD from email.xsd.
Note that the --generate-wildcard option is used to request the
wildcard mapping.
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 content of the object model to STDERR. Next the driver creates a
reply email which is then serialized to XML.
To run the example on the sample XML instance document simply execute:
$ ./driver email.xml
|