Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 23-Aug-2017 | - | ||||
README | H A D | 23-Aug-2017 | 1.6 KiB | 52 | 41 | |
balance.xml | H A D | 23-Aug-2017 | 380 | 17 | 6 | |
deposit.xml | H A D | 23-Aug-2017 | 407 | 18 | 7 | |
driver.cxx | H A D | 23-Aug-2017 | 3.8 KiB | 162 | 110 | |
makefile | H A D | 23-Aug-2017 | 4.1 KiB | 114 | 68 | |
protocol-pimpl.cxx | H A D | 23-Aug-2017 | 723 | 47 | 29 | |
protocol-pimpl.hxx | H A D | 23-Aug-2017 | 881 | 49 | 36 | |
protocol.hxx | H A D | 23-Aug-2017 | 879 | 62 | 49 | |
protocol.map | H A D | 23-Aug-2017 | 256 | 12 | 9 | |
protocol.xsd | H A D | 23-Aug-2017 | 1.3 KiB | 51 | 36 | |
withdraw.xml | H A D | 23-Aug-2017 | 412 | 18 | 7 |
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