diff options
Diffstat (limited to 'xsd-examples/cxx/tree/custom/comments')
-rw-r--r-- | xsd-examples/cxx/tree/custom/comments/README | 42 | ||||
-rw-r--r-- | xsd-examples/cxx/tree/custom/comments/buildfile | 8 |
2 files changed, 37 insertions, 13 deletions
diff --git a/xsd-examples/cxx/tree/custom/comments/README b/xsd-examples/cxx/tree/custom/comments/README index 8fd69d0..32412db 100644 --- a/xsd-examples/cxx/tree/custom/comments/README +++ b/xsd-examples/cxx/tree/custom/comments/README @@ -16,9 +16,17 @@ people.xml Sample XML instance document. xml-schema.hxx - C++ types for XML Schema built-in types. This header file is generated - by XSD using the --generate-xml-schema option. The --custom-type option - is also used to customize the xsd:anyType type. + C++ types for XML Schema built-in types. + + This header file is generated by by the XSD compiler in the + --generate-xml-schema mode using the following command line: + + xsd cxx-tree --generate-xml-schema \ + --generate-serialization \ + --custom-type anyType=/type_base \ + --hxx-epilogue '#include "xml-schema-custom.hxx"' xml-schema.xsd + + The --custom-type option is used to customize the xsd:anyType type. people.hxx people.ixx @@ -26,9 +34,15 @@ people.cxx C++ types that represent the person record vocabulary, a set of parsing functions that convert XML instance documents to a tree-like in-memory object model, and a set of serialization functions that - convert the object model back to XML. These are generated by XSD - from people.xsd with the --extern-xml-schema option in order to - include xml-schema.hxx. + convert the object model back to XML. + + These files are generated by the XSD compiler from people.xsd using the + following command line: + + xsd cxx-tree --generate-serialization --extern-xml-schema xml-schema.xsd \ + people.xsd + + The --extern-xml-schema option in used to include xml-schema.hxx. xml-schema-custom.hxx Header file which defines our own xml_schema::type class. It is @@ -52,6 +66,18 @@ driver.cxx on this object model. Finally, it serializes the modified object model back to XML, including XML comments. -To run the example on the sample XML instance document simply execute: +To compile and link the example manually from the command line we can use +the following commands (replace 'c++' with your C++ compiler name): + +c++ -DXSD_CXX11 -c people.cxx +c++ -DXSD_CXX11 -c xml-schema-custom.cxx +c++ -DXSD_CXX11 -c dom-parse.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o people.o xml-schema-custom.o dom-parse.o -lxerces-c + +Note that we need to define the XSD_CXX11 preprocessor macro since the +source code includes libxsd headers directly. + +To run the example on the sample XML instance document execute: -$ ./driver people.xml +./driver people.xml diff --git a/xsd-examples/cxx/tree/custom/comments/buildfile b/xsd-examples/cxx/tree/custom/comments/buildfile index 093a6cc..6edf81a 100644 --- a/xsd-examples/cxx/tree/custom/comments/buildfile +++ b/xsd-examples/cxx/tree/custom/comments/buildfile @@ -15,9 +15,7 @@ exe{driver}: xml{people}: test.input = true <{hxx ixx cxx}{people}>: xsd{people} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-tree --std c++11 \ + $xsd cxx-tree \ --generate-inline \ --generate-serialization \ --extern-xml-schema xml-schema.xsd \ @@ -27,12 +25,12 @@ exe{driver}: xml{people}: test.input = true hxx{xml-schema}: $xsd {{ - diag xsd gen ($>[0]) + diag xsd $> # Note that the specified xml-schema.xsd doesn't exist and is only used to # deduce the generated header name. # - $xsd cxx-tree --std c++11 \ + $xsd cxx-tree \ --generate-xml-schema \ --generate-serialization \ --custom-type anyType=/type_base \ |