diff options
Diffstat (limited to 'examples/cxx/hybrid/polyroot/README')
-rw-r--r-- | examples/cxx/hybrid/polyroot/README | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/polyroot/README b/examples/cxx/hybrid/polyroot/README new file mode 100644 index 0000000..3d690f5 --- /dev/null +++ b/examples/cxx/hybrid/polyroot/README @@ -0,0 +1,60 @@ +This example shows how to handle XML vocabularies with polymorphic document +root elements in the Embedded C++/Hybrid mapping. For general coverage of +XML Schema polymorphism handling see the polymorphism example. + +The example consists of the following files: + +supermen.xsd + XML Schema which describes supermen instance documents. + +person.xml +superman.xml +batman.xml + Sample XML instance documents. + +supermen.hxx +supermen.cxx + +supermen-pskel.hxx +supermen-pskel.cxx +supermen-pimpl.hxx +supermen-pimpl.cxx + +supermen-pskel.hxx +supermen-pskel.cxx +supermen-pimpl.hxx +supermen-pimpl.cxx + Object model (the first pair of files), parser skeletons (the + second pair), parser implementations (the third pair), serializer + skeletons (the fourth pair), and serializer implementations (the + fifth pair). These files are generated by the XSD/e compiler from + supermen.xsd. The --generate-parser, --generate-serializer, and + --generate-aggregate options were used to request the generation + of the parsing and serialization code. The --generate-polymorphic + option was used to request the generation of the polymorphism-aware + code. Since our vocabulary uses substitution groups, the XSD/e + compiler is able to automatically determine which type hierarchy is + polymorphic (otherwise we would have had to use the --polymorphic-type + option). The --generate-typeinfo option was used to request the + generation of custom type information for polymorphic object model + types. Finally, the --root-element option was used to specify the + document root element. + +driver.cxx + Driver for the example. It first calls the parser that constructs + the object model from the input XML file. It then prints the content + of the object model to STDERR at which point it determines the actual + (dynamic) types of polymorphic objects. Finally, the driver calls the + serializer to serialize the object model back to XML. + +To run the example on the sample XML instance documents simply execute: + +$ ./driver person.xml +$ ./driver superman.xml +$ ./driver batman.xml + +The example reads from STDIN if input file is not specified: + +$ ./driver <person.xml +$ ./driver <superman.xml +$ ./driver <batman.xml |