aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/filter/README
blob: 6ff8f76ec8ee3d2c35ec50f7f88c24ef1e030acd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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