diff options
Diffstat (limited to 'xsd-examples/cxx/tree/custom/calendar')
-rw-r--r-- | xsd-examples/cxx/tree/custom/calendar/README | 37 | ||||
-rw-r--r-- | xsd-examples/cxx/tree/custom/calendar/buildfile | 8 |
2 files changed, 33 insertions, 12 deletions
diff --git a/xsd-examples/cxx/tree/custom/calendar/README b/xsd-examples/cxx/tree/custom/calendar/README index f7f6989..a4297ba 100644 --- a/xsd-examples/cxx/tree/custom/calendar/README +++ b/xsd-examples/cxx/tree/custom/calendar/README @@ -16,17 +16,29 @@ calendar.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:date type. + C++ types for XML Schema built-in types. + + This header file is generated by the XSD compiler in the + --generate-xml-schema mode using the following command line: + + xsd cxx-tree --generate-xml-schema --custom-type date \ + --hxx-epilogue '#include "xml-schema-custom.hxx"' xml-schema.xsd + + The --custom-type option is used to customize the xsd:date type. calendar.hxx calendar.ixx calendar.cxx C++ types that represent the given vocabulary and a set of parsing functions that convert XML instance documents to a tree-like in-memory - object model. These are generated by XSD from calendar.xsd with the - --extern-xml-schema option in order to include xml-schema.hxx. + object model. + + These files are generated by the XSD compiler from calendar.xsd using the + following command line: + + xsd cxx-tree --extern-xml-schema xml-schema.xsd calendar.xsd + + The --extern-xml-schema option is used to include xml-schema.hxx. xml-schema-custom.hxx Header file which defines our own xml_schema::date class. It is @@ -42,6 +54,17 @@ driver.cxx that constructs the object model from the input file. It then prints the calendar events to STDERR. -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 calendar.cxx +c++ -DXSD_CXX11 -c xml-schema-custom.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o calendar.o xml-schema-custom.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 calendar.xml +./driver calendar.xml diff --git a/xsd-examples/cxx/tree/custom/calendar/buildfile b/xsd-examples/cxx/tree/custom/calendar/buildfile index 3c26122..3309f6f 100644 --- a/xsd-examples/cxx/tree/custom/calendar/buildfile +++ b/xsd-examples/cxx/tree/custom/calendar/buildfile @@ -16,9 +16,7 @@ exe{driver}: xml{calendar}: test.input = true <{hxx ixx cxx}{calendar}>: xsd{calendar} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-tree --std c++11 \ + $xsd cxx-tree \ --generate-inline \ --extern-xml-schema xml-schema.xsd \ --output-dir $out_base \ @@ -27,12 +25,12 @@ exe{driver}: xml{calendar}: 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 \ --custom-type date \ --hxx-epilogue '#include "xml-schema-custom.hxx"' \ |