• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..23-Aug-2017-

READMEH A D23-Aug-20172 KiB5845

dom-parse.cxxH A D23-Aug-20172.6 KiB9442

dom-parse.hxxH A D23-Aug-2017611 2311

driver.cxxH A D23-Aug-20172.1 KiB9154

makefileH A D23-Aug-20174.2 KiB12473

people.xmlH A D23-Aug-2017447 219

people.xsdH A D23-Aug-2017761 3017

xml-schema-custom.cxxH A D23-Aug-20172.3 KiB11872

xml-schema-custom.hxxH A D23-Aug-20171.3 KiB5835

README

1This example shows how to customize the anyType XML Schema built-in
2type to implement preservation of comments stored in XML documents.
3Because anyType is a base type for every generated type, you can use
4this technique to implement custom functionality that spans the
5entire type system. For more information on the C++/Tree mapping
6customization see the C++/Tree Mapping Customization Guide[2].
7
8[2] http://wiki.codesynthesis.com/Tree/Customization_guide
9
10The example consists of the following files:
11
12people.xsd
13  XML Schema definition for a simple person record vocabulary.
14
15people.xml
16  Sample XML instance document.
17
18xml-schema.hxx
19  C++ types for XML Schema built-in types. This header file is generated
20  by XSD using the --generate-xml-schema option. The --custom-type option
21  is also used to customize the xsd:anyType type.
22
23people.hxx
24people.ixx
25people.cxx
26  C++ types that represent the person record vocabulary, a set of
27  parsing functions that convert XML instance documents to a tree-like
28  in-memory object model, and a set of serialization functions that
29  convert the object model back to XML. These are generated by XSD
30  from people.xsd with the --extern-xml-schema option in order to
31  include xml-schema.hxx.
32
33xml-schema-custom.hxx
34  Header file which defines our own xml_schema::type class. It is
35  included at the end of xml-schema.hxx using the --hxx-epilogue
36  option.
37
38xml-schema-custom.cxx
39  Source file which contains the implementation of our xml_schema:type
40  class.
41
42dom-parse.hxx
43dom-parse.cxx
44  Definition and implementation of the parse() function that
45  parses an XML document to a DOM document while preserving
46  XML comments.
47
48driver.cxx
49  Driver for the example. It first calls the above parse() function
50  to parse the input file to a DOM document. It then parses the DOM
51  document to the object model and performs a number of modifications
52  on this object model. Finally, it serializes the modified object
53  model back to XML, including XML comments.
54
55To run the example on the sample XML instance document simply execute:
56
57$ ./driver people.xml
58