From 741bfb659caaa771c748d03df26792fab10e5778 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 26 Sep 2023 10:43:31 +0200 Subject: Add XSD and C++ compiler command lines to example READMEs --- xsd-examples/cxx/parser/generated/README | 34 ++++++++++++++----- xsd-examples/cxx/parser/hello/README | 25 +++++++++++--- xsd-examples/cxx/parser/library/README | 27 ++++++++++++--- xsd-examples/cxx/parser/mixed/README | 26 ++++++++++++--- xsd-examples/cxx/parser/mixin/README | 27 ++++++++++++--- xsd-examples/cxx/parser/multiroot/README | 31 +++++++++++++---- xsd-examples/cxx/parser/performance/README | 44 ++++++++++++++++++++----- xsd-examples/cxx/parser/polymorphism/README | 26 +++++++++++++-- xsd-examples/cxx/parser/polyroot/README | 30 ++++++++++++++--- xsd-examples/cxx/parser/wildcard/README | 24 ++++++++++++-- xsd-examples/cxx/tree/binary/boost/README | 37 ++++++++++++++++----- xsd-examples/cxx/tree/binary/cdr/README | 29 ++++++++++++---- xsd-examples/cxx/tree/binary/xdr/README | 25 ++++++++++---- xsd-examples/cxx/tree/caching/README | 21 ++++++++++-- xsd-examples/cxx/tree/compression/README | 38 +++++++++++++++------ xsd-examples/cxx/tree/custom/calendar/README | 37 +++++++++++++++++---- xsd-examples/cxx/tree/custom/comments/README | 42 ++++++++++++++++++----- xsd-examples/cxx/tree/custom/contacts/README | 23 ++++++++++--- xsd-examples/cxx/tree/custom/contacts/buildfile | 10 +++--- xsd-examples/cxx/tree/custom/double/README | 44 +++++++++++++++++++------ xsd-examples/cxx/tree/custom/mixed/README | 30 +++++++++++++---- xsd-examples/cxx/tree/custom/taxonomy/README | 34 +++++++++++++++---- xsd-examples/cxx/tree/custom/wildcard/README | 24 +++++++++++--- xsd-examples/cxx/tree/embedded/README | 44 ++++++++++++++++++++----- xsd-examples/cxx/tree/hello/README | 18 ++++++++-- xsd-examples/cxx/tree/library/README | 18 ++++++++-- xsd-examples/cxx/tree/messaging/README | 41 ++++++++++++++++------- xsd-examples/cxx/tree/mixed/README | 21 ++++++++++-- xsd-examples/cxx/tree/multiroot/README | 28 ++++++++++++---- xsd-examples/cxx/tree/order/element/README | 34 ++++++++++++++----- xsd-examples/cxx/tree/order/mixed/README | 25 ++++++++++---- xsd-examples/cxx/tree/performance/README | 41 ++++++++++++++++++----- xsd-examples/cxx/tree/polymorphism/README | 22 ++++++++++--- xsd-examples/cxx/tree/secure/README | 22 +++++++++++-- xsd-examples/cxx/tree/streaming/.gitignore | 1 + xsd-examples/cxx/tree/streaming/README | 26 ++++++++++++--- xsd-examples/cxx/tree/wildcard/README | 23 +++++++++++-- xsd-examples/cxx/tree/xpath/README | 22 +++++++++++-- 38 files changed, 858 insertions(+), 216 deletions(-) diff --git a/xsd-examples/cxx/parser/generated/README b/xsd-examples/cxx/parser/generated/README index ca56974..d772ab8 100644 --- a/xsd-examples/cxx/parser/generated/README +++ b/xsd-examples/cxx/parser/generated/README @@ -13,20 +13,38 @@ library.xml library-pskel.hxx library-pskel.cxx - Parser skeletons generated by XSD from library.xsd. + Parser skeletons generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-parser --generate-print-impl --generate-test-driver library.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --generate-print-impl \ + --generate-test-driver library.xsd library-pimpl.hxx library-pimpl.cxx Sample parser implementations that print the XML data to STDOUT. - These are generated by XSD from library.xsd with the - --generate-print-impl option. + These are also generated by the above XSD command (requested with + the --generate-print-impl option). library-driver.cxx - Sample driver for the example. It is generated by XSD from - library.xsd with the --generate-test-driver option. + Sample driver for the example. It is also generated by the above + XSD command (requested with the --generate-test-driver option). + +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++ -c library-pskel.cxx +c++ -c library-pimpl.cxx +c++ -c library-driver.cxx +c++ -o driver library-driver.o library-pskel.o library-pimpl.o -lxerces-c + +Or if using Expat as the underlying XML parser: +c++ -o driver library-driver.o library-pskel.o library-pimpl.o -lexpat -To run the example on the sample XML instance document simply -execute: +To run the example on the sample XML instance document execute: -$ ./library-driver library.xml +./driver library.xml diff --git a/xsd-examples/cxx/parser/hello/README b/xsd-examples/cxx/parser/hello/README index 97449de..fc4656d 100644 --- a/xsd-examples/cxx/parser/hello/README +++ b/xsd-examples/cxx/parser/hello/README @@ -11,7 +11,14 @@ hello.xml hello-pskel.hxx hello-pskel.cxx - Parser skeletons generated by XSD from hello.xsd. + Parser skeletons generated by the XSD compiler from hello.xsd using the + following command line: + + xsd cxx-parser hello.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat hello.xsd driver.cxx A parser implementation and a driver for the example. The @@ -22,7 +29,17 @@ driver.cxx In then invokes this parser instance to parse the input file. -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++ -c hello-pskel.cxx +c++ -c driver.cxx +c++ -o driver driver.o hello-pskel.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o hello-pskel.o -lexpat + +To run the example on the sample XML instance document execute: -$ ./driver hello.xml +./driver hello.xml diff --git a/xsd-examples/cxx/parser/library/README b/xsd-examples/cxx/parser/library/README index 3f515f6..c0af7fc 100644 --- a/xsd-examples/cxx/parser/library/README +++ b/xsd-examples/cxx/parser/library/README @@ -20,8 +20,14 @@ library.map library-pskel.hxx library-pskel.ixx library-pskel.cxx - Parser skeletons generated by XSD from library.xsd and - library.map. + Parser skeletons generated by the XSD compiler from library.xsd and + library.map using the following command line: + + xsd cxx-parser --type-map=library.map library.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --type-map=library.map library.xsd library-pimpl.hxx library-pimpl.cxx @@ -38,7 +44,18 @@ driver.cxx object model. Finally, it prints the contents of the in-memory object model 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++ -c library-pskel.cxx +c++ -c library-pimpl.cxx +c++ -c driver.cxx +c++ -o driver driver.o library-pskel.o library-pimpl.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o library-pskel.o library-pimpl.o -lexpat + +To run the example on the sample XML instance document execute: -$ ./driver library.xml +./driver library.xml diff --git a/xsd-examples/cxx/parser/mixed/README b/xsd-examples/cxx/parser/mixed/README index 23ace6f..a00a86d 100644 --- a/xsd-examples/cxx/parser/mixed/README +++ b/xsd-examples/cxx/parser/mixed/README @@ -32,8 +32,14 @@ text.map text-pskel.hxx text-pskel.cxx - Parser skeletons generated by XSD from text.xsd and - text.map. + Parser skeletons generated by the XSD compiler from text.xsd and + text.map using the following command line: + + xsd cxx-parser --type-map=text.map text.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --type-map=text.map text.xsd driver.cxx A parser implementation and a driver for the example. The @@ -43,7 +49,17 @@ driver.cxx parsers for the XML Schema built-in types. In then invokes this parser instance to parse the input file. -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++ -c text-pskel.cxx +c++ -c driver.cxx +c++ -o driver driver.o text-pskel.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o text-pskel.o -lexpat + +To run the example on the sample XML instance document: -$ ./driver text.xml +./driver text.xml diff --git a/xsd-examples/cxx/parser/mixin/README b/xsd-examples/cxx/parser/mixin/README index 343e379..20e5d53 100644 --- a/xsd-examples/cxx/parser/mixin/README +++ b/xsd-examples/cxx/parser/mixin/README @@ -20,15 +20,32 @@ schema.map schema-pskel.hxx schema-pskel.cxx - Parser skeletons generated by XSD from schema.xsd and - schema.map. + Parser skeletons generated by the XSD compiler from schema.xsd and + schema.map using the following command line: + + xsd cxx-parser --type-map=schema.map schema.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --type-map=schema.map schema.xsd driver.cxx Parser implementations and a driver for the example. It shows how to mix the implementation of the base parser into the derived parser. -To run the example on the sample XML instance document simply -execute: -$ ./driver instance.xml +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++ -c schema-pskel.cxx +c++ -c driver.cxx +c++ -o driver driver.o schema-pskel.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o schema-pskel.o -lexpat + +To run the example on the sample XML instance document execute: + +./driver instance.xml diff --git a/xsd-examples/cxx/parser/multiroot/README b/xsd-examples/cxx/parser/multiroot/README index 041dfec..410784d 100644 --- a/xsd-examples/cxx/parser/multiroot/README +++ b/xsd-examples/cxx/parser/multiroot/README @@ -22,8 +22,14 @@ protocol.map protocol-pskel.hxx protocol-pskel.cxx - Parser skeletons generated by XSD from protocol.xsd and - protocol.map. + Parser skeletons generated by the XSD compiler from protocol.xsd and + protocol.map using the following command line: + + xsd cxx-parser --type-map=protocol.map protocol.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --type-map=protocol.map protocol.xsd protocol-pimpl.hxx protocol-pimpl.cxx @@ -43,9 +49,20 @@ driver.cxx parse the input file and produce the in-memory object model. Finally, it prints the contents of the object model to STDERR. -To run the example on the sample XML request documents 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++ -c protocol-pskel.cxx +c++ -c protocol-pimpl.cxx +c++ -c driver.cxx +c++ -o driver driver.o protocol-pskel.o protocol-pimpl.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o protocol-pskel.o protocol-pimpl.o -lexpat + +To run the example on the sample XML request documents execute: -$ ./driver balance.xml -$ ./driver withdraw.xml -$ ./driver deposit.xml +./driver balance.xml +./driver withdraw.xml +./driver deposit.xml diff --git a/xsd-examples/cxx/parser/performance/README b/xsd-examples/cxx/parser/performance/README index 46137d0..eda0b16 100644 --- a/xsd-examples/cxx/parser/performance/README +++ b/xsd-examples/cxx/parser/performance/README @@ -13,6 +13,16 @@ test-50k.xml gen.cxx Program to generate a test document of desired size. + To compile and link this program we can use the following commands (replace + 'c++' with your C++ compiler name): + + c++ -c gen.cxx + c++ -o gen gen.o + + To generate the test document execute, for example: + + ./gen 633 test-100k.xml + time.hxx time.cxx Class definition that represents time. @@ -20,7 +30,14 @@ time.cxx test-pskel.hxx test-pskel.ixx test-pskel.cxx - Parser skeletons generated by the XSD compiler from test.xsd. + Parser skeletons generated by the XSD compiler from test.xsd using the + following command line: + + xsd cxx-parser --skel-file-suffix=-xerces-pskel test.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --skel-file-suffix=-expat-pskel test.xsd driver.cxx Driver for the example. It first parses the command line arguments @@ -30,17 +47,28 @@ driver.cxx measurement loop which on each iteration parses the XML document from the in-memory buffer. -To run the example on a test XML 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): -$ ./driver test-50k.xml +c++ -c test-xerces-pskel.cxx +c++ -c time.cxx +c++ -DXERCES_PARSER -c driver.cxx +c++ -o driver driver.o time.o test-xerces-pskel.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -c test-expat-pskel.cxx +c++ -c time.cxx +c++ -c driver.cxx +c++ -o driver driver.o time.o test-expat-pskel.o -lexpat + +To run the example on a test XML document execute: + +./driver test-50k.xml The -v option can be used to turn on validation in the underlying XML parser (only makes sense for Xerces-C++, off by default). The -i option can be used to specify the number of parsing iterations (1000 by default). For example: -$ ./driver -v -i 100 test-50k.xml - -To generate the test document execute, for example: - -$ ./gen 633 test-100k.xml +./driver -v -i 100 test-50k.xml diff --git a/xsd-examples/cxx/parser/polymorphism/README b/xsd-examples/cxx/parser/polymorphism/README index 60a97e9..a25464e 100644 --- a/xsd-examples/cxx/parser/polymorphism/README +++ b/xsd-examples/cxx/parser/polymorphism/README @@ -13,7 +13,15 @@ supermen.xml supermen-pskel.hxx supermen-pskel.cxx - Parser skeletons generated by the XSD compiler from supermen.xsd. + Parser skeletons generated by the XSD compiler from supermen.xsd using + the following command line: + + xsd cxx-parser --generate-polymorphic supermen.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --generate-polymorphic supermen.xsd + Note the use of the --generate-polymorphic command line option. supermen-pimpl.hxx @@ -25,6 +33,18 @@ driver.cxx all the individual parsers found in supermen-pimpl.hxx. It then invokes this parser instance to parse the input file. -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++ -c supermen-pskel.cxx +c++ -c supermen-pimpl.cxx +c++ -c driver.cxx +c++ -o driver driver.o supermen-pskel.o supermen-pimpl.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o supermen-pskel.o supermen-pimpl.o -lexpat + +To run the example on the sample XML instance document execute: -$ ./driver supermen.xml +./driver supermen.xml diff --git a/xsd-examples/cxx/parser/polyroot/README b/xsd-examples/cxx/parser/polyroot/README index f41b91c..b431417 100644 --- a/xsd-examples/cxx/parser/polyroot/README +++ b/xsd-examples/cxx/parser/polyroot/README @@ -14,7 +14,15 @@ batman.xml supermen-pskel.hxx supermen-pskel.cxx - Parser skeletons generated by the XSD compiler from supermen.xsd. + Parser skeletons generated by the XSD compiler from supermen.xsd using + the following command line: + + xsd cxx-parser --generate-polymorphic supermen.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat --generate-polymorphic supermen.xsd + Note the use of the --generate-polymorphic command line option. supermen-pimpl.hxx @@ -29,8 +37,20 @@ driver.cxx found in supermen-pimpl.hxx. In then invokes this parser instance to parse the input file. -To run the example on the sample XML instance documents 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++ -c supermen-pskel.cxx +c++ -c supermen-pimpl.cxx +c++ -c driver.cxx +c++ -o driver driver.o supermen-pskel.o supermen-pimpl.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o supermen-pskel.o supermen-pimpl.o -lexpat + +To run the example on the sample XML instance documents execute: -$ ./driver person.xml -$ ./driver superman.xml -$ ./driver batman.xml +./driver person.xml +./driver superman.xml +./driver batman.xml diff --git a/xsd-examples/cxx/parser/wildcard/README b/xsd-examples/cxx/parser/wildcard/README index 89f9aa9..181a2d8 100644 --- a/xsd-examples/cxx/parser/wildcard/README +++ b/xsd-examples/cxx/parser/wildcard/README @@ -11,7 +11,14 @@ email.xml email-pskel.hxx email-pskel.cxx - Parser skeletons generated by XSD from email.xsd. + Parser skeletons generated by the XSD compiler from email.xsd using the + following command line: + + xsd cxx-parser email.xsd + + Or if using Expat instead of Xerces-C++ as the underlying XML parser: + + xsd cxx-parser --xml-parser=expat email.xsd driver.cxx Parser implementations and a driver for the example. The @@ -22,6 +29,17 @@ driver.cxx In then invokes the parser instances to parse the input file. -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++ -c email-pskel.cxx +c++ -c driver.cxx +c++ -o driver driver.o email-pskel.o -lxerces-c + +Or if using Expat as the underlying XML parser: + +c++ -o driver driver.o email-pskel.o -lexpat + +To run the example on the sample XML instance document execute: -$ ./driver email.xml +./driver email.xml diff --git a/xsd-examples/cxx/tree/binary/boost/README b/xsd-examples/cxx/tree/binary/boost/README index 6cdd2dd..4f5ae9a 100644 --- a/xsd-examples/cxx/tree/binary/boost/README +++ b/xsd-examples/cxx/tree/binary/boost/README @@ -28,13 +28,22 @@ library-prologue.hxx library.hxx library.cxx C++ types that represent the given vocabulary as well as Boost - archive insertion and extraction operations. These are generated - by the XSD compiler from library.xsd. The --hxx-prologue-file - option is used to insert the contents of the library-prologue.hxx - file into the generated header file. The --generate-insertion and - --generate-extraction options are used to generate the insertion - and extraction operations for text_oarchive and text_iarchive - types. + archive insertion and extraction operations. + + These files are generated by the XSD compiler from library.xsd + using the following command line: + + xsd cxx-tree --generate-ostream \ + --hxx-prologue-file=library-prologue.hxx \ + --generate-insertion 'boost::archive::text_oarchive' \ + --generate-extraction 'boost::archive::text_iarchive' \ + library.xsd + + The --hxx-prologue-file option is used to insert the contents of + the library-prologue.hxx file into the generated header file. The + --generate-insertion and --generate-extraction options are used to + generate the insertion and extraction operations for text_oarchive + and text_iarchive types. driver.cxx Driver for the example. It first calls one of the parsing functions @@ -44,6 +53,16 @@ driver.cxx representation as well as the content of the object model before saving it to text_oarchive and after loading it from text_iarchive. -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 library.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o library.o -lboost_serialization -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 library.xml +./driver library.xml diff --git a/xsd-examples/cxx/tree/binary/cdr/README b/xsd-examples/cxx/tree/binary/cdr/README index 914d27c..5e3b7ba 100644 --- a/xsd-examples/cxx/tree/binary/cdr/README +++ b/xsd-examples/cxx/tree/binary/cdr/README @@ -17,11 +17,19 @@ library.xml library.hxx library.cxx C++ types that represent the given vocabulary as well as data - representation stream insertion and extraction operations. These - are generated by XSD from library.xsd. Note that the - --generate-insertion and --generate-extraction options are used - to generate the insertion and extraction operations for ACE CDR - stream. + representation stream insertion and extraction operations. + + These files are generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-tree --generate-ostream \ + --generate-insertion 'ACE_OutputCDR' \ + --generate-extraction 'ACE_InputCDR' \ + --generate-comparison library.xsd + + Note that the --generate-insertion and --generate-extraction options + are used to generate the insertion and extraction operations for ACE + CDR stream. driver.cxx Driver for the example. It first calls one of the parsing functions @@ -31,6 +39,13 @@ driver.cxx representation as well as the content of the object model before saving it to the CDR stream and after loading it from the CDR stream. -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++ -c library.cxx +c++ -c driver.cxx +c++ -o driver driver.o library.o -lACE -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver library.xml +./driver library.xml diff --git a/xsd-examples/cxx/tree/binary/xdr/README b/xsd-examples/cxx/tree/binary/xdr/README index e02b2b9..2096064 100644 --- a/xsd-examples/cxx/tree/binary/xdr/README +++ b/xsd-examples/cxx/tree/binary/xdr/README @@ -17,10 +17,16 @@ library.xml library.hxx library.cxx C++ types that represent the given vocabulary as well as data - representation stream insertion and extraction operations. These - are generated by XSD from library.xsd. Note that the - --generate-insertion and --generate-extraction options are used - to generate the insertion and extraction operations for XDR + representation stream insertion and extraction operations. + + These files are generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-tree --generate-ostream --generate-comparison \ + --generate-insertion 'XDR' --generate-extraction 'XDR' library.xsd + + Note that the --generate-insertion and --generate-extraction options + are used to generate the insertion and extraction operations for XDR stream. driver.cxx @@ -31,6 +37,13 @@ driver.cxx it to the XDR representation and after loading it from the XDR representation. -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++ -c library.cxx +c++ -c driver.cxx +c++ -o driver driver.o library.o -ltirpc -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver library.xml +./driver library.xml diff --git a/xsd-examples/cxx/tree/caching/README b/xsd-examples/cxx/tree/caching/README index 64dffb3..1672d6f 100644 --- a/xsd-examples/cxx/tree/caching/README +++ b/xsd-examples/cxx/tree/caching/README @@ -14,7 +14,12 @@ library.hxx library.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 library.xsd. + object model. + + These files are generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-tree library.xsd driver.cxx Driver for the example. It first sets up the Xerces-C++ DOM parser @@ -24,6 +29,16 @@ driver.cxx the object model from this DOM document. On each iteration the driver prints a number of books in the object model 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 library.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o library.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 library.xml library.xsd +./driver library.xml library.xsd diff --git a/xsd-examples/cxx/tree/compression/README b/xsd-examples/cxx/tree/compression/README index f163970..e2b7dd5 100644 --- a/xsd-examples/cxx/tree/compression/README +++ b/xsd-examples/cxx/tree/compression/README @@ -1,8 +1,8 @@ -This example shows how to compress an XML document during serialization -and decompress it during parsing. The example uses the compression +This example shows how to compress an XML document during serialization +and decompress it during parsing. The example uses the compression functionality provided by the zlib library[1] which needs to be installed in order to build and run this example. It should also be fairly straight- -forward to modify the code in this example to use other compression +forward to modify the code in this example to use other compression libraries. [1] http://www.zlib.net @@ -31,18 +31,36 @@ library.hxx library.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 library.xsd. + object model. + + These files are generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-tree --generate-serialization --generate-ostream library.xsd driver.cxx - Driver for the example. It first creates the compressed_input_source - object and passes it to one of the parsing functions that constructs - the object model from the compressed input file. It then prints the - content of the object model to STDERR. Finally, the driver creates the + Driver for the example. It first creates the compressed_input_source + object and passes it to one of the parsing functions that constructs + the object model from the compressed input file. It then prints the + content of the object model to STDERR. Finally, the driver creates the compressed_format_target object and passes it to one of the serialization functions which converts the object model back to the compressed XML. -To run the example on the sample XML 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 library.cxx +c++ -DXSD_CXX11 -c compressed-format-target.cxx +c++ -DXSD_CXX11 -c compressed-input-source.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o library.o compressed-format-target.o \ + compressed-input-source.o -lz -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 document execute: -$ ./driver library.xml.gz +./driver library.xml.gz The serialization output is written to the out.xml.gz file. 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/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/contacts/README b/xsd-examples/cxx/tree/custom/contacts/README index 072ede3..b2f95eb 100644 --- a/xsd-examples/cxx/tree/custom/contacts/README +++ b/xsd-examples/cxx/tree/custom/contacts/README @@ -19,8 +19,15 @@ contacts.ixx contacts.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 contacts.xsd with the - --custom-type option in order to customize the contact type. + object model. + + These files are generated by the XSD compiler from contacts.xsd using the + following command line: + + xsd cxx-tree --custom-type contact=/contact_base \ + --hxx-epilogue '#include "contacts-custom.hxx"' contacts.xsd + + The --custom-type option is used to customize the contact type. contacts-custom.hxx Header file which defines our own contact class by inheriting from the @@ -35,6 +42,14 @@ driver.cxx that constructs the object model from the input file. It then prints the contacts 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++ -c contacts.cxx +c++ -c contacts-custom.cxx +c++ -c driver.cxx +c++ -o driver driver.o contacts.o contacts-custom.o -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver contacts.xml +./driver contacts.xml diff --git a/xsd-examples/cxx/tree/custom/contacts/buildfile b/xsd-examples/cxx/tree/custom/contacts/buildfile index e401362..51e9c99 100644 --- a/xsd-examples/cxx/tree/custom/contacts/buildfile +++ b/xsd-examples/cxx/tree/custom/contacts/buildfile @@ -12,11 +12,11 @@ exe{driver}: xml{contacts}: test.input = true <{hxx ixx cxx}{contacts}>: xsd{contacts} $xsd {{ - $xsd cxx-tree \ - --generate-inline \ - --custom-type contact=/contact_base \ - --hxx-epilogue '#include "contacts-custom.hxx"' \ - --output-dir $out_base \ + $xsd cxx-tree \ + --generate-inline \ + --custom-type contact=/contact_base \ + --hxx-epilogue '#include "contacts-custom.hxx"' \ + --output-dir $out_base \ $path($<[0]) }} diff --git a/xsd-examples/cxx/tree/custom/double/README b/xsd-examples/cxx/tree/custom/double/README index 15348d2..bf95104 100644 --- a/xsd-examples/cxx/tree/custom/double/README +++ b/xsd-examples/cxx/tree/custom/double/README @@ -8,7 +8,7 @@ http://wiki.codesynthesis.com/Tree/Customization_guide In this example our schema uses xsd:double to represent a price. There are two potential problems with this choice of a price type. First, xsd:double can be serialized in the scientific notation which would be an unusual way -of representing a price. Second, we would like to limit the number of +of representing a price. Second, we would like to limit the number of fraction digits in our prices to 2. Furthermore, we would like to always have two fraction digits, even if one or both of them are zeros, for example: 12.99, 12.90, 12.00. @@ -42,21 +42,45 @@ double-custom.cxx file described below. xml-schema.hxx - C++ types for XML Schema built-in types. This header file is generated - by the XSD compiler using the --generate-xml-schema option. The - --custom-type option is used to customize the xsd:double type. The - --hxx-epilogue option is used to include the double-custom.hxx file - at the end of this file. + 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 --generate-serialization \ + --custom-type double=double \ + --hxx-epilogue '#include "double-custom.hxx"' xml-schema.xsd + + The --custom-type option is used to customize the xsd:double type. The + --hxx-epilogue option is used to include the double-custom.hxx file at + the end of this file. order.hxx order.cxx - C++ types generated from order.xsd. The --extern-xml-schema option - is used to include xml-schema.hxx into order.hxx. + C++ types are generated by the XSD compiler from order.xsd using the + following command line: + + xsd cxx-tree --generate-serialization --extern-xml-schema xml-schema.xsd \ + order.xsd + + The --extern-xml-schema option is used to include xml-schema.hxx into + order.hxx. driver.cxx Test driver for the example. It creates a sample order and then writes it to XML to test the custom xsd:double serialization code. -To run the example 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 order.cxx +c++ -DXSD_CXX11 -c double-custom.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o order.o double-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 execute: -$ ./driver +./driver diff --git a/xsd-examples/cxx/tree/custom/mixed/README b/xsd-examples/cxx/tree/custom/mixed/README index 7b56812..8f7bd13 100644 --- a/xsd-examples/cxx/tree/custom/mixed/README +++ b/xsd-examples/cxx/tree/custom/mixed/README @@ -1,6 +1,6 @@ This example shows how to use type customization to parse and serialize -mixed content. The example achieves this by customizing the type with -the mixed content model to include a DOM document that stores the data +mixed content. The example achieves this by customizing the type with +the mixed content model to include a DOM document that stores the data as a raw XML representation. The customized type also provides its own parsing constructor and serialization operator where the mixed content is extracted from and inserted back to DOM, respectively. The use of @@ -28,8 +28,15 @@ people.cxx C++ types that represent the given 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 --custom-type option in order to customize the bio type. + 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 --custom-type bio=/bio_base \ + --hxx-epilogue '#include "people-custom.hxx"' people.xsd + + The --custom-type option is used to customize the bio type. people-custom.hxx Header file which defines our own bio class by inheriting from the @@ -45,6 +52,17 @@ driver.cxx the data to STDERR, including the bio information converted to text. Finally, the driver serializes the object model back to XML. -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 people-custom.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o people.o people-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 people.xml +./driver people.xml diff --git a/xsd-examples/cxx/tree/custom/taxonomy/README b/xsd-examples/cxx/tree/custom/taxonomy/README index c2e425a..3296508 100644 --- a/xsd-examples/cxx/tree/custom/taxonomy/README +++ b/xsd-examples/cxx/tree/custom/taxonomy/README @@ -20,12 +20,24 @@ people.ixx people.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 people.xsd with the - --custom-type option in order to customize the person, superman, and + object model. + + These files are generated by the XSD compiler from people.xsd using the + following command line: + + xsd cxx-tree --generate-forward --generate-polymorphic \ + --polymorphic-type person \ + --custom-type "person=person_impl/person_base" \ + --custom-type "superman=superman_impl/superman_base" \ + --custom-type "batman=batman_impl/batman_base" \ + --fwd-prologue '#include "people-custom-fwd.hxx"' \ + --hxx-prologue '#include "people-custom.hxx"' people.xsd + + The --custom-type option is used to customize the person, superman, and batman types. Generation of the people-fwd.hxx forward declaration - file is requested with the --generate-forward option. Note also that - we use the --generate-polymorphic command line option as well as - --polymorphic-type to mark the type hierarchy starting with the + file is requested with the --generate-forward option. Note also that + we use the --generate-polymorphic command line option as well as + --polymorphic-type to mark the type hierarchy starting with the person type as polymorphic. people-custom-fwd.hxx @@ -48,6 +60,14 @@ driver.cxx that constructs the object model from the input file. It then prints the database 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++ -c people.cxx +c++ -c people-custom.cxx +c++ -c driver.cxx +c++ -o driver driver.o people.o people-custom.o -lxerces-c + +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/wildcard/README b/xsd-examples/cxx/tree/custom/wildcard/README index 70eaea4..8b5b2f0 100644 --- a/xsd-examples/cxx/tree/custom/wildcard/README +++ b/xsd-examples/cxx/tree/custom/wildcard/README @@ -23,8 +23,16 @@ wildcard.cxx C++ types that represent the given 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 wildcard.xsd - with the --custom-type option in order to customize the data type. + object model back to XML. + + These files are generated by the XSD compiler from wildcard.xsd using + the following command line: + + xsd cxx-tree --generate-serialization --generate-ostream \ + --custom-type data=/data_base \ + --hxx-epilogue '#include "wildcard-custom.hxx"' wildcard.xsd + + The --custom-type option is used to customize the data type. wildcard-custom.hxx Header file which defines our own data class by inheriting from the @@ -40,6 +48,14 @@ driver.cxx the data to STDERR, including the extra attribute. Finally, the driver serializes the object model back to XML. -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++ -c wildcard.cxx +c++ -c wildcard-custom.cxx +c++ -c driver.cxx +c++ -o driver driver.o wildcard.o wildcard-custom.o -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver wildcard.xml +./driver wildcard.xml diff --git a/xsd-examples/cxx/tree/embedded/README b/xsd-examples/cxx/tree/embedded/README index 266a8ff..f1946bf 100644 --- a/xsd-examples/cxx/tree/embedded/README +++ b/xsd-examples/cxx/tree/embedded/README @@ -1,5 +1,5 @@ This example shows how to embed the binary representation of the schema -grammar into an application and then use it with the C++/Tree mapping to +grammar into an application and then use it with the C++/Tree mapping to parse and validate XML documents. This example is similar to the 'caching' example except that it loads the binary representation of the schemas embedded into the application instead of pre-parsing external schema files. @@ -8,10 +8,16 @@ The example consists of the following files: xsdbin.cxx Tool for converting one or more XML Schema files to the compressed binary - representation. The output is written as a pair of C++ source files + representation. The output is written as a pair of C++ source files containing the array with the binary data. Use the --help option to see the tool's usage information. + To compile and link this tool we can use the following commands (replace + 'c++' with your C++ compiler name): + + c++ -c xsdbin.cxx + c++ -o xsdbin xsdbin.o -lxerces-c + library.xsd XML Schema which describes a library of books. @@ -22,16 +28,25 @@ library.hxx library.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 the XSD compiler from library.xsd. + object model. + + These files are generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-tree library.xsd library-schema.hxx library-schema.cxx - Binary representation of the library.xsd schema. These files are generated - by the xsdbin tool. + Binary representation of the library.xsd schema. + + These files are generated by the xsdbin tool from library.xsd using the + following command line: + + ./xsdbin library.xsd grammar-input-stream.hxx grammar-input-stream.cxx - Input stream implementation with the special-purpose schema grammar + Input stream implementation with the special-purpose schema grammar decompression algorithm. It is used to load the binary schema representation produced by the xsdbin tool. @@ -43,6 +58,19 @@ driver.cxx model from this DOM document. On each iteration the driver prints a number of books in the object model 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 library.cxx +c++ -DXSD_CXX11 -c library-schema.cxx +c++ -DXSD_CXX11 -c grammar-input-stream.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o library.o library-schema.o grammar-input-stream.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 library.xml +./driver library.xml diff --git a/xsd-examples/cxx/tree/hello/README b/xsd-examples/cxx/tree/hello/README index bb98584..989d6da 100644 --- a/xsd-examples/cxx/tree/hello/README +++ b/xsd-examples/cxx/tree/hello/README @@ -14,13 +14,25 @@ hello.hxx hello.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 hello.xsd. + object model. + + These files are generated by the XSD compiler from hello.xsd using the + following command line: + + xsd cxx-tree hello.xsd driver.cxx Driver for the example. It first calls one of the parsing functions that constructs the object model from the input file. It then prints the content of the object model 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++ -c hello.cxx +c++ -c driver.cxx +c++ -o driver driver.o hello.o -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver hello.xml +./driver hello.xml diff --git a/xsd-examples/cxx/tree/library/README b/xsd-examples/cxx/tree/library/README index 0b8638c..bd4fb90 100644 --- a/xsd-examples/cxx/tree/library/README +++ b/xsd-examples/cxx/tree/library/README @@ -16,7 +16,12 @@ library.cxx C++ types that represent the given vocabulary, a set of parsing functions that convert XML 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 library.xsd. + model back to XML. + + These files are generated by the XSD compiler from library.xsd using + the following command line: + + xsd cxx-tree --generate-ostream --generate-serialization library.xsd driver.cxx Driver for the example. It first calls one of the parsing functions @@ -24,9 +29,16 @@ driver.cxx the content of the object model to STDERR. Finally, the driver modifies the object model and serializes it back to XML. -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++ -c library.cxx +c++ -c driver.cxx +c++ -o driver driver.o library.o -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver library.xml +./driver library.xml This example also shows how to use the ID/IDREF cross-referencing mechanism and the xsd:enumeration to C++ enum mapping. diff --git a/xsd-examples/cxx/tree/messaging/README b/xsd-examples/cxx/tree/messaging/README index 435a4cf..d3d92c6 100644 --- a/xsd-examples/cxx/tree/messaging/README +++ b/xsd-examples/cxx/tree/messaging/README @@ -19,12 +19,18 @@ deposit.xml protocol.hxx protocol.cxx - C++ types that represent the given vocabulary. These are - generated by the XSD compiler from protocol.xsd. Generation of - element types instead of parsing and serialization functions is - requested with the --generate-element-type option. Generation of - the element map is requested with the --generate-element-map - option. + C++ types that represent the given vocabulary. + + These files are generated by the XSD compiler from protocol.xsd using + the following command line: + + xsd cxx-tree --root-element-all --generate-element-type \ + --generate-element-map --generate-serialization protocol.xsd + + Generation of element types instead of parsing and serialization + functions is requested with the --generate-element-type option. + Generation of the element map is requested with the + --generate-element-map option. dom-parse.hxx dom-parse.cxx @@ -49,10 +55,21 @@ driver.cxx driver serializes the opaque response object to a DOM document using the element map and then serializes this DOM document to STDOUT using the above-mentioned serialize() function. - -To run the example on the sample XML request documents simply -execute: -$ ./driver balance.xml -$ ./driver withdraw.xml -$ ./driver deposit.xml +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 protocol.cxx +c++ -DXSD_CXX11 -c dom-parse.cxx +c++ -DXSD_CXX11 -c dom-serialize.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o protocol.o dom-parse.o dom-serialize.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 request documents execute: + +./driver balance.xml +./driver withdraw.xml +./driver deposit.xml diff --git a/xsd-examples/cxx/tree/mixed/README b/xsd-examples/cxx/tree/mixed/README index fc23faa..49ec809 100644 --- a/xsd-examples/cxx/tree/mixed/README +++ b/xsd-examples/cxx/tree/mixed/README @@ -32,7 +32,12 @@ text.hxx text.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 text.xsd. + object model. + + These files are generated by the XSD compiler from text.xsd using the + following command line: + + xsd cxx-tree text.xsd driver.cxx Driver for the example. It first calls one of the parsing functions @@ -40,6 +45,16 @@ driver.cxx both the underlying DOM and statically-typed mapping to perform the transformation. -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 text.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o text.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 text.xml +./driver text.xml diff --git a/xsd-examples/cxx/tree/multiroot/README b/xsd-examples/cxx/tree/multiroot/README index b742422..81c6b26 100644 --- a/xsd-examples/cxx/tree/multiroot/README +++ b/xsd-examples/cxx/tree/multiroot/README @@ -20,8 +20,12 @@ protocol.hxx protocol.cxx C++ types that represent the given vocabulary and a set of parsing functions that convert XML documents to a tree-like - in-memory object model. These are generated by XSD from - protocol.xsd. + in-memory object model. + + These files are generated by the XSD compiler from protocol.xsd using + the following command line: + + xsd cxx-tree --root-element-all protocol.xsd dom-parse.hxx dom-parse.cxx @@ -37,9 +41,19 @@ driver.cxx This example intentionally does not support the deposit request to show how to handle unknown documents. -To run the example on the sample XML request documents 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 protocol.cxx +c++ -DXSD_CXX11 -c dom-parse.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o protocol.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 request documents execute: -$ ./driver balance.xml -$ ./driver withdraw.xml -$ ./driver deposit.xml +./driver balance.xml +./driver withdraw.xml +./driver deposit.xml diff --git a/xsd-examples/cxx/tree/order/element/README b/xsd-examples/cxx/tree/order/element/README index 19f2381..bd6d0c9 100644 --- a/xsd-examples/cxx/tree/order/element/README +++ b/xsd-examples/cxx/tree/order/element/README @@ -8,18 +8,24 @@ transactions.xsd transactions can contain any number of different transactions in any order but the order of transaction in the batch is significant. -library.xml +transactions.xml Sample XML instance document. transactions.hxx transactions.cxx C++ types that represent the given vocabulary as well as a set of - parsing and serialization functions. These are generated by XSD - from transactions.xsd. Note that the --ordered-type option is - used to indicate to the XSD compiler that the batch type is - ordered. We also use the --generate-wildcard option to enable - wildcard support. An element wildcard is used in the batch to - allow transaction extensions. + parsing and serialization functions. + + These files are generated by the XSD compiler from transactions.xsd + using the following command line: + + xsd cxx-tree --generate-serialization --generate-wildcard \ + --ordered-type batch transactions.xsd + + Note that the --ordered-type option is used to indicate to the XSD + compiler that the batch type is ordered. We also use the + --generate-wildcard option to enable wildcard support. An element + wildcard is used in the batch to allow transaction extensions. driver.cxx Driver for the example. It first calls one of the parsing functions @@ -30,6 +36,16 @@ driver.cxx Finally, it saves the modified transaction batch back to XML to verify that the content order is preserved in the output document. -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 transactions.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o transactions.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 transactions.xml +./driver transactions.xml diff --git a/xsd-examples/cxx/tree/order/mixed/README b/xsd-examples/cxx/tree/order/mixed/README index e66c1ad..bc209f6 100644 --- a/xsd-examples/cxx/tree/order/mixed/README +++ b/xsd-examples/cxx/tree/order/mixed/README @@ -25,10 +25,16 @@ text.xml text.hxx text.cxx C++ types that represent the given vocabulary as well as a set of - parsing and serialization functions. These are generated by XSD - from text.xsd. Note that the --ordered-type-mixed option is used - to indicate to the XSD compiler that all types with mixed content - should be automatically treated as ordered. + parsing and serialization functions. + + These files are generated by the XSD compiler from text.xsd using the + following command line: + + xsd cxx-tree --generate-serialization --ordered-type-mixed text.xsd + + Note that the --ordered-type-mixed option is used to indicate to the XSD + compiler that all types with mixed content should be automatically treated + as ordered. driver.cxx Driver for the example. It first calls one of the parsing functions @@ -40,6 +46,13 @@ driver.cxx text back to XML to verify that the content order is preserved in the output document. -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++ -c text.cxx +c++ -c driver.cxx +c++ -o driver driver.o text.o -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver text.xml +./driver text.xml diff --git a/xsd-examples/cxx/tree/performance/README b/xsd-examples/cxx/tree/performance/README index 0206387..65e3edd 100644 --- a/xsd-examples/cxx/tree/performance/README +++ b/xsd-examples/cxx/tree/performance/README @@ -13,6 +13,16 @@ test-50k.xml gen.cxx Program to generate a test document of desired size. + To compile and link this program we can use the following commands + (replace 'c++' with your C++ compiler name): + + c++ -c gen.cxx + c++ -o gen gen.o + + To generate the test document execute, for example: + + ./gen 633 test-100k.xml + time.hxx time.cxx Class definition that represents time. @@ -23,8 +33,12 @@ test.cxx C++ types that represent the given vocabulary, a set of parsing functions that convert XML 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 the XSD compiler from - test.xsd. + model back to XML. + + These files are generated by the XSD compiler from test.xsd using the + following command line: + + xsd cxx-tree --generate-serialization test.xsd parsing.cxx Parsing performance test. It first reads the entire document into @@ -46,17 +60,26 @@ driver.cxx It then initializes the Xerces-C++ runtime and calls the parsing and serialization tests described above. -To run the example on a test XML 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): -$ ./driver test-50k.xml +c++ -DXSD_CXX11 -c test.cxx +c++ -DXSD_CXX11 -c time.cxx +c++ -DXSD_CXX11 -c parsing.cxx +c++ -DXSD_CXX11 -c serialization.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o test.o time.o parsing.o serialization.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 a test XML document execute: + +./driver test-50k.xml The -v option can be used to turn on validation in the underlying XML parser (off by default). The -i option can be used to specify the number of parsing and serialization iterations (1000 by default). For example: -$ ./driver -v -i 100 test-50k.xml - -To generate the test document execute, for example: - -$ ./gen 633 test-100k.xml +./driver -v -i 100 test-50k.xml diff --git a/xsd-examples/cxx/tree/polymorphism/README b/xsd-examples/cxx/tree/polymorphism/README index 6e54e49..368ddd0 100644 --- a/xsd-examples/cxx/tree/polymorphism/README +++ b/xsd-examples/cxx/tree/polymorphism/README @@ -14,9 +14,16 @@ supermen.cxx C++ types that represent the given 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 supermen.xsd. + object model back to XML. + + These files are generated by the XSD compiler from supermen.xsd using + the following command line: + + xsd cxx-tree --generate-polymorphic --generate-serialization \ + --root-element-last supermen.xsd + Note also that we use the --generate-polymorphic command line option - and that we don't need to use --polymorphic-type to explicitly mark + and that we don't need to use --polymorphic-type to explicitly mark types as polymorphic because this is automatically deduced by the XSD compiler from the substitution groups used in the supermen.xsd schema. @@ -27,6 +34,13 @@ driver.cxx the content of the object model to STDERR. Finally, the driver serializes the object model back to XML. -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++ -c supermen.cxx +c++ -c driver.cxx +c++ -o driver driver.o supermen.o -lxerces-c + +To run the example on the sample XML instance document execute: -$ ./driver instance.xml +./driver supermen.xml diff --git a/xsd-examples/cxx/tree/secure/README b/xsd-examples/cxx/tree/secure/README index 649f0a3..7fa6445 100644 --- a/xsd-examples/cxx/tree/secure/README +++ b/xsd-examples/cxx/tree/secure/README @@ -19,7 +19,12 @@ library.hxx library.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 the XSD compiler from library.xsd. + object model. + + These files are generated by the XSD compiler from library.xsd using the + following command line: + + xsd cxx-tree library.xsd secure-dom-parser.hxx secure-dom-parser.cxx @@ -33,9 +38,20 @@ driver.cxx this DOM document. Finally, the driver prints a number of books in the object model 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 library.cxx +c++ -DXSD_CXX11 -c secure-dom-parser.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o library.o secure-dom-parser.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 library.xml +./driver library.xml To verify that DTD processing is disabled, uncomment a different DOCTYPE version in the sample document. diff --git a/xsd-examples/cxx/tree/streaming/.gitignore b/xsd-examples/cxx/tree/streaming/.gitignore index db4a6e9..d2232b3 100644 --- a/xsd-examples/cxx/tree/streaming/.gitignore +++ b/xsd-examples/cxx/tree/streaming/.gitignore @@ -1 +1,2 @@ position.?xx +out.xml diff --git a/xsd-examples/cxx/tree/streaming/README b/xsd-examples/cxx/tree/streaming/README index 5a467e0..23d3a7f 100644 --- a/xsd-examples/cxx/tree/streaming/README +++ b/xsd-examples/cxx/tree/streaming/README @@ -18,8 +18,12 @@ position.xml position.hxx position.cxx C++ types that represent the position vocabulary as well as parsing - and serialization functions. These are generated by XSD from - position.xsd. + and serialization functions. + + These files are generated by the XSD compiler from position.xsd using + the following command line: + + xsd cxx-tree --generate-serialization position.xsd parser.hxx parser.cxx @@ -44,8 +48,22 @@ driver.cxx It also serializes the object model fragments into a new XML document (out.xml). -To run the example 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 position.cxx +c++ -DXSD_CXX11 -c parser.cxx +c++ -DXSD_CXX11 -c serializer.cxx +c++ -DXSD_CXX11 -c grammar-input-stream.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o position.o parser.o serializer.o \ + grammar-input-stream.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 position.xml +./driver position.xml The serialization results are written to the out.xml file. diff --git a/xsd-examples/cxx/tree/wildcard/README b/xsd-examples/cxx/tree/wildcard/README index d451509..8b89774 100644 --- a/xsd-examples/cxx/tree/wildcard/README +++ b/xsd-examples/cxx/tree/wildcard/README @@ -19,7 +19,14 @@ email.cxx C++ types that represent the given 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 email.xsd. + object model back to XML. + + These files are generated by the XSD compiler from email.xsd using the + following command line: + + xsd cxx-tree --generate-wildcard --generate-serialization \ + --root-element message email.xsd + Note that the --generate-wildcard option is used to request the wildcard mapping. @@ -29,6 +36,16 @@ driver.cxx the content of the object model to STDERR. Next the driver creates a reply email which is then serialized to XML. -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 email.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o email.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 email.xml +./driver email.xml diff --git a/xsd-examples/cxx/tree/xpath/README b/xsd-examples/cxx/tree/xpath/README index 1187743..39f9c09 100644 --- a/xsd-examples/cxx/tree/xpath/README +++ b/xsd-examples/cxx/tree/xpath/README @@ -22,7 +22,12 @@ people.hxx people.cxx C++ types that represent the person record 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 people.xsd. + in-memory object model. + + These files are generated by the XSD compiler from people.xsd using + the following command line: + + xsd cxx-tree people.xsd dom-parse.hxx dom-parse.cxx @@ -38,6 +43,17 @@ driver.cxx the result by getting back from the returned DOM nodes to object model nodes. -To run the example on the sample XML 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 dom-parse.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o people.o dom-parse.o -lxqilla -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 document execute: -$ ./driver people.xml +./driver people.xml -- cgit v1.1