diff options
Diffstat (limited to 'xsd-examples/cxx/parser')
21 files changed, 252 insertions, 84 deletions
diff --git a/xsd-examples/cxx/parser/README b/xsd-examples/cxx/parser/README index 01906c7..e1016ce 100644 --- a/xsd-examples/cxx/parser/README +++ b/xsd-examples/cxx/parser/README @@ -42,4 +42,4 @@ performance mixed Shows how to handle raw, "type-less content" such as mixed content - models, anyType/anySimpleType, and any/anyAttribute.
\ No newline at end of file + models, anyType/anySimpleType, and any/anyAttribute. 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/generated/buildfile b/xsd-examples/cxx/parser/generated/buildfile index 5e4adac..85aded9 100644 --- a/xsd-examples/cxx/parser/generated/buildfile +++ b/xsd-examples/cxx/parser/generated/buildfile @@ -17,9 +17,7 @@ exe{driver}: xml{library}: test.input = true {hxx cxx}{library-pimpl} \ { cxx}{library-driver}>: xsd{library} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --generate-print-impl \ 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/hello/buildfile b/xsd-examples/cxx/parser/hello/buildfile index 2df4a7f..c136334 100644 --- a/xsd-examples/cxx/parser/hello/buildfile +++ b/xsd-examples/cxx/parser/hello/buildfile @@ -12,9 +12,7 @@ exe{driver}: xml{hello}: test.input = true <{hxx ixx cxx}{hello-pskel}>: xsd{hello} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --output-dir $out_base \ 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/library/buildfile b/xsd-examples/cxx/parser/library/buildfile index 40810b3..2d463e5 100644 --- a/xsd-examples/cxx/parser/library/buildfile +++ b/xsd-examples/cxx/parser/library/buildfile @@ -12,9 +12,7 @@ exe{driver}: xml{library}: test.input = true <{hxx ixx cxx}{library-pskel}>: xsd{library} map{library} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --type-map $path($<[1]) \ 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/mixed/buildfile b/xsd-examples/cxx/parser/mixed/buildfile index 0079444..103d94b 100644 --- a/xsd-examples/cxx/parser/mixed/buildfile +++ b/xsd-examples/cxx/parser/mixed/buildfile @@ -12,9 +12,7 @@ exe{driver}: xml{text}: test.input = true <{hxx ixx cxx}{text-pskel}>: xsd{text} map{text} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --type-map $path($<[1]) \ 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/mixin/buildfile b/xsd-examples/cxx/parser/mixin/buildfile index 4d4d751..7b6cee2 100644 --- a/xsd-examples/cxx/parser/mixin/buildfile +++ b/xsd-examples/cxx/parser/mixin/buildfile @@ -12,9 +12,7 @@ exe{driver}: xml{instance}: test.input = true <{hxx ixx cxx}{schema-pskel}>: xsd{schema} map{schema} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --type-map $path($<[1]) \ 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/multiroot/buildfile b/xsd-examples/cxx/parser/multiroot/buildfile index 6b0f604..4c97ca1 100644 --- a/xsd-examples/cxx/parser/multiroot/buildfile +++ b/xsd-examples/cxx/parser/multiroot/buildfile @@ -11,9 +11,7 @@ exe{driver}: {hxx cxx}{* -protocol-pskel} {hxx ixx cxx}{protocol-pskel} $libs \ <{hxx ixx cxx}{protocol-pskel}>: xsd{protocol} map{protocol} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --type-map $path($<[1]) \ 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/performance/buildfile b/xsd-examples/cxx/parser/performance/buildfile index 10111d6..1d0edd7 100644 --- a/xsd-examples/cxx/parser/performance/buildfile +++ b/xsd-examples/cxx/parser/performance/buildfile @@ -33,9 +33,7 @@ for p: 'xerces' 'expat' parser = $p } {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -$parser-pskel \ --xml-parser $parser \ 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/polymorphism/buildfile b/xsd-examples/cxx/parser/polymorphism/buildfile index de088cf..2fad7dd 100644 --- a/xsd-examples/cxx/parser/polymorphism/buildfile +++ b/xsd-examples/cxx/parser/polymorphism/buildfile @@ -12,9 +12,7 @@ exe{driver}: xml{supermen}: test.input = true <{hxx ixx cxx}{supermen-pskel}>: xsd{supermen} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --generate-polymorphic \ 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/polyroot/buildfile b/xsd-examples/cxx/parser/polyroot/buildfile index 6ae0fdc..c1943d4 100644 --- a/xsd-examples/cxx/parser/polyroot/buildfile +++ b/xsd-examples/cxx/parser/polyroot/buildfile @@ -11,9 +11,7 @@ exe{driver}: {hxx cxx}{* -supermen-pskel} {hxx ixx cxx}{supermen-pskel} $libs \ <{hxx ixx cxx}{supermen-pskel}>: xsd{supermen} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --generate-polymorphic \ 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/parser/wildcard/buildfile b/xsd-examples/cxx/parser/wildcard/buildfile index 93e2dc8..5866f38 100644 --- a/xsd-examples/cxx/parser/wildcard/buildfile +++ b/xsd-examples/cxx/parser/wildcard/buildfile @@ -12,9 +12,7 @@ exe{driver}: xml{email}: test.input = true <{hxx ixx cxx}{email-pskel}>: xsd{email} $xsd {{ - diag xsd ($<[0]) # @@ TMP - - $xsd cxx-parser --std c++11 \ + $xsd cxx-parser \ --generate-inline \ --skel-file-suffix -pskel \ --output-dir $out_base \ |