Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 23-Aug-2017 | - | ||||
README | H A D | 23-Aug-2017 | 1.1 KiB | 37 | 28 | |
batman.xml | H A D | 23-Aug-2017 | 340 | 17 | 6 | |
driver.cxx | H A D | 23-Aug-2017 | 3.2 KiB | 139 | 91 | |
makefile | H A D | 23-Aug-2017 | 3.7 KiB | 111 | 64 | |
person.xml | H A D | 23-Aug-2017 | 286 | 16 | 5 | |
superman.xml | H A D | 23-Aug-2017 | 338 | 17 | 6 | |
supermen-pimpl.cxx | H A D | 23-Aug-2017 | 1.2 KiB | 86 | 62 | |
supermen-pimpl.hxx | H A D | 23-Aug-2017 | 1.2 KiB | 65 | 40 | |
supermen.xsd | H A D | 23-Aug-2017 | 888 | 37 | 23 |
README
1This example shows how to handle the xsi:type attributes when it is used 2on root elements. For general coverage of XML Schema polymorphism handling 3in the C++/Parser mapping see the polymorphism example. 4 5The example consists of the following files: 6 7supermen.xsd 8 XML Schema which describes the "supermen" instance documents. 9 10person.xml 11superman.xml 12batman.xml 13 Sample XML instance documents. 14 15supermen-pskel.hxx 16supermen-pskel.cxx 17 Parser skeletons generated by the XSD compiler from supermen.xsd. 18 Note the use of the --generate-polymorphic command line option. 19 20supermen-pimpl.hxx 21supermen-pimpl.cxx 22 Parser implementations that print the XML data to STDOUT. 23 24driver.cxx 25 Driver for the example. It implements a custom document parser 26 that determines which XML Schema type is being parsed and uses 27 the corresponding parser implementation. The driver first 28 constructs a parser instance from all the individual parsers 29 found in supermen-pimpl.hxx. In then invokes this parser instance 30 to parse the input file. 31 32To run the example on the sample XML instance documents simply execute: 33 34$ ./driver person.xml 35$ ./driver superman.xml 36$ ./driver batman.xml 37