blob: a525533edfb19f715e49ea56c2fd1f1e85c3a183 (
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
49
50
51
|
This example is a minimal parser 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.xml
Sample XML instance document.
gender.hxx
C++ gender enum that corresponds to the gender types
in people.xsd.
people.map
Type map. It maps XML Schema gender type defined in
people.xsd to C++ gender enum defined in gender.hxx.
people-pskel.hxx
people-pskel.ixx
people-pskel.cxx
Parser skeletons generated by XSD/e from people.xsd and
people.map. The --no-stl and --no-exceptions options
were used to produce these files.
people-pimpl-mixin.hxx
people-pimpl-tiein.hxx
Parser implementations (using either mixin or tiein parser
reuse style) that prints the results to STDERR. These are
hand-written implementations of the parser skeletons defined
in people-pskel.hxx.
driver.cxx
Driver for the example. It first constructs a parser instance
from the parser implementation mentioned above and a couple of
predefined parsers for the XML Schema built-in types. In then
invokes this parser instance to parse the input file. It also
shows how to handle parsing and validation errors using error
codes.
To run the example on the sample XML instance document simply
execute:
$ ./driver people.xml
The example reads from STDIN if input file is not specified:
$ ./driver <people.xml
|