diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-09-26 10:43:31 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-09-27 15:13:24 +0300 |
commit | 741bfb659caaa771c748d03df26792fab10e5778 (patch) | |
tree | db562df317a95507f8d66fdd63916cf198b95ec2 /xsd-examples/cxx/parser | |
parent | 38d7c2a86cce70436ad359a62c603d64710e8471 (diff) |
Add XSD and C++ compiler command lines to example READMEs
Diffstat (limited to 'xsd-examples/cxx/parser')
-rw-r--r-- | xsd-examples/cxx/parser/generated/README | 34 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/hello/README | 25 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/library/README | 27 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/mixed/README | 26 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/mixin/README | 27 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/multiroot/README | 31 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/performance/README | 44 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/polymorphism/README | 26 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/polyroot/README | 30 | ||||
-rw-r--r-- | xsd-examples/cxx/parser/wildcard/README | 24 |
10 files changed, 241 insertions, 53 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 |