diff options
Diffstat (limited to 'examples/cxx/hybrid/polymorphism/README')
-rw-r--r-- | examples/cxx/hybrid/polymorphism/README | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/polymorphism/README b/examples/cxx/hybrid/polymorphism/README new file mode 100644 index 0000000..2e00636 --- /dev/null +++ b/examples/cxx/hybrid/polymorphism/README @@ -0,0 +1,57 @@ +This example shows how to handle XML vocabularies that use the XML +Schema polymorphism features such as the xsi:type attribute and +substitution groups in the Embedded C++/Hybrid mapping. The case +where xsi:type or substitution groups are used on document root +elements is covered in the polyroot examples. + +The example consists of the following files: + +supermen.xsd + XML Schema which describes supermen instance documents. + +supermen.xml + Sample XML instance document. + +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 modifies + the object model by adding another polymorphic instance and calls the + serializer to serialize it back to XML. + +To run the example on the sample XML instance document simply execute: + +$ ./driver supermen.xml + +The example reads from STDIN if input file is not specified: + +$ ./driver <supermen.xml |