• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..23-Aug-2017-

READMEH A D23-Aug-20171.6 KiB5241

balance.xmlH A D23-Aug-2017380 176

deposit.xmlH A D23-Aug-2017407 187

driver.cxxH A D23-Aug-20173.8 KiB162110

makefileH A D23-Aug-20174.1 KiB11468

protocol-pimpl.cxxH A D23-Aug-2017723 4729

protocol-pimpl.hxxH A D23-Aug-2017881 4936

protocol.hxxH A D23-Aug-2017879 6249

protocol.mapH A D23-Aug-2017256 129

protocol.xsdH A D23-Aug-20171.3 KiB5136

withdraw.xmlH A D23-Aug-2017412 187

README

1This example shows how to handle XML vocabularies with multiple
2root elements using the C++/Parser mapping.
3
4The example consists of the following files:
5
6protocol.xsd
7  XML Schema which defines a simple bank account protocol with
8  requests such as withdraw and deposit.
9
10balance.xml
11withdraw.xml
12deposit.xml
13  Sample XML instances for the protocol requests.
14
15protocol.hxx
16  C++ types that describe the protocol requests. These are
17  hand-written.
18
19protocol.map
20  Type map. It maps XML Schema types defined in protocol.xsd
21  to the C++ types defined in protocol.hxx.
22
23protocol-pskel.hxx
24protocol-pskel.cxx
25  Parser skeletons generated by XSD from protocol.xsd and
26  protocol.map.
27
28protocol-pimpl.hxx
29protocol-pimpl.cxx
30  Parser implementations that construct the custom object
31  model from an XML instance using the types from protocol.hxx.
32  These are hand-written implementations of the parser skeletons
33  defined in protocol-pskel.hxx.
34
35driver.cxx
36  Driver for the example. It implements a custom document parser
37  that determines which request is being parsed and uses the
38  corresponding parser implementation. The document parser
39  intentionally does not support the deposit request to show
40  how to handle unknown documents. The driver first constructs
41  a parser instance from all the individual parsers found in
42  protocol-pimpl.hxx. In then invokes this parser instance to
43  parse the input file and produce the in-memory object model.
44  Finally, it prints the contents of the object model to STDERR.
45
46To run the example on the sample XML request documents simply
47execute:
48
49$ ./driver balance.xml
50$ ./driver withdraw.xml
51$ ./driver deposit.xml
52