aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/filter/README
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cxx/hybrid/filter/README')
-rw-r--r--examples/cxx/hybrid/filter/README71
1 files changed, 71 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/filter/README b/examples/cxx/hybrid/filter/README
new file mode 100644
index 0000000..6ff8f76
--- /dev/null
+++ b/examples/cxx/hybrid/filter/README
@@ -0,0 +1,71 @@
+This example shows how to filter the XML data during parsing and object
+model during serialization in the Embedded C++/Hybrid mapping. Filtering
+allows only parts of the XML document to be parsed into the object model
+or only parts of the object model to be serialized to XML.
+
+This example uses the parser and serializer customization mechanisms
+provided by the C++/Hybrid mapping. For more information, see Section
+4.8, "Customizing the Object Model" and Section 6.1, "Customizing
+Parsers and Serializers" in the Embedded C++/Hybrid Mapping Getting
+Started Guide.
+
+The example consists of the following files:
+
+people.xsd
+ XML Schema which describes a collection of person records.
+
+people.xml
+ Sample XML instance document.
+
+people.hxx
+people.cxx
+
+people-pskel.hxx
+people-pskel.cxx
+people-pimpl.hxx
+people-pimpl.cxx
+
+people-pskel.hxx
+people-pskel.cxx
+people-pimpl.hxx
+people-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 people.xsd. The
+ --generate-parser, --generate-serializer, and --generate-aggregate
+ options were used to request the generation of the parsing and
+ serialization code. The --custom-parser option was used to customize
+ the people_pimpl parser implementation. The --custom-serializer
+ option was used to customize the people_simpl serializer
+ implementation.
+
+people-custom-pimpl.hxx
+people-custom-pimpl.cxx
+ Custom people parser implementation. It uses the implementation
+ generated by the XSD/e compiler as a base and overrides the person()
+ callback to filter the records being parsed.
+
+people-custom-simpl.hxx
+people-custom-simpl.cxx
+ Custom people serializer implementation. It uses the implementation
+ generated by the XSD/e compiler as a base and overrides the
+ person_next() callbacks to filter the records being serialized.
+
+driver.cxx
+ Driver for the example. It first sets the filter parameters on the
+ parser object and then calls it to construct the object model from
+ the input XML file. Only records matching the parser filter end up
+ in the object model. The driver then prints the content of the object
+ model to STDERR. Finally, the driver sets the filter parameters on
+ the serializer object and calls it to serialize the object model back
+ to XML. Only records matching the serializer filter end up in the
+ resulting XML.
+
+To run the example on the sample XML instance document simply execute:
+
+$ ./driver people.xml
+
+The example reads from STDIN if input file is not specified:
+
+$ ./driver <people.xml