summaryrefslogtreecommitdiff
path: root/xsd-examples/cxx/tree
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-examples/cxx/tree')
-rw-r--r--xsd-examples/cxx/tree/binary/boost/README37
-rw-r--r--xsd-examples/cxx/tree/binary/boost/buildfile4
-rw-r--r--xsd-examples/cxx/tree/binary/cdr/README29
-rw-r--r--xsd-examples/cxx/tree/binary/cdr/buildfile4
-rw-r--r--xsd-examples/cxx/tree/binary/xdr/README25
-rw-r--r--xsd-examples/cxx/tree/binary/xdr/buildfile4
-rw-r--r--xsd-examples/cxx/tree/caching/README21
-rw-r--r--xsd-examples/cxx/tree/caching/buildfile4
-rw-r--r--xsd-examples/cxx/tree/compression/README38
-rw-r--r--xsd-examples/cxx/tree/compression/buildfile4
-rw-r--r--xsd-examples/cxx/tree/custom/calendar/README37
-rw-r--r--xsd-examples/cxx/tree/custom/calendar/buildfile8
-rw-r--r--xsd-examples/cxx/tree/custom/comments/README42
-rw-r--r--xsd-examples/cxx/tree/custom/comments/buildfile8
-rw-r--r--xsd-examples/cxx/tree/custom/contacts/README23
-rw-r--r--xsd-examples/cxx/tree/custom/contacts/buildfile12
-rw-r--r--xsd-examples/cxx/tree/custom/double/README44
-rw-r--r--xsd-examples/cxx/tree/custom/double/buildfile8
-rw-r--r--xsd-examples/cxx/tree/custom/mixed/README30
-rw-r--r--xsd-examples/cxx/tree/custom/mixed/buildfile4
-rw-r--r--xsd-examples/cxx/tree/custom/taxonomy/README34
-rw-r--r--xsd-examples/cxx/tree/custom/taxonomy/buildfile4
-rw-r--r--xsd-examples/cxx/tree/custom/wildcard/README24
-rw-r--r--xsd-examples/cxx/tree/custom/wildcard/buildfile4
-rw-r--r--xsd-examples/cxx/tree/embedded/README44
-rw-r--r--xsd-examples/cxx/tree/embedded/buildfile6
-rw-r--r--xsd-examples/cxx/tree/hello/README18
-rw-r--r--xsd-examples/cxx/tree/hello/buildfile4
-rw-r--r--xsd-examples/cxx/tree/library/README18
-rw-r--r--xsd-examples/cxx/tree/library/buildfile4
-rw-r--r--xsd-examples/cxx/tree/messaging/README41
-rw-r--r--xsd-examples/cxx/tree/messaging/buildfile4
-rw-r--r--xsd-examples/cxx/tree/mixed/README21
-rw-r--r--xsd-examples/cxx/tree/mixed/buildfile4
-rw-r--r--xsd-examples/cxx/tree/multiroot/README28
-rw-r--r--xsd-examples/cxx/tree/multiroot/buildfile4
-rw-r--r--xsd-examples/cxx/tree/order/element/README34
-rw-r--r--xsd-examples/cxx/tree/order/element/buildfile4
-rw-r--r--xsd-examples/cxx/tree/order/mixed/README25
-rw-r--r--xsd-examples/cxx/tree/order/mixed/buildfile4
-rw-r--r--xsd-examples/cxx/tree/performance/README41
-rw-r--r--xsd-examples/cxx/tree/performance/buildfile4
-rw-r--r--xsd-examples/cxx/tree/polymorphism/README22
-rw-r--r--xsd-examples/cxx/tree/polymorphism/buildfile4
-rw-r--r--xsd-examples/cxx/tree/secure/README22
-rw-r--r--xsd-examples/cxx/tree/secure/buildfile4
-rw-r--r--xsd-examples/cxx/tree/streaming/.gitignore1
-rw-r--r--xsd-examples/cxx/tree/streaming/README26
-rw-r--r--xsd-examples/cxx/tree/streaming/buildfile4
-rw-r--r--xsd-examples/cxx/tree/wildcard/README23
-rw-r--r--xsd-examples/cxx/tree/wildcard/buildfile4
-rw-r--r--xsd-examples/cxx/tree/xpath/README22
-rw-r--r--xsd-examples/cxx/tree/xpath/buildfile4
53 files changed, 649 insertions, 247 deletions
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/boost/buildfile b/xsd-examples/cxx/tree/binary/boost/buildfile
index 4306273..17e67fb 100644
--- a/xsd-examples/cxx/tree/binary/boost/buildfile
+++ b/xsd-examples/cxx/tree/binary/boost/buildfile
@@ -13,9 +13,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} hxx{library-prologue} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-ostream \
--hxx-prologue-file $path($<[1]) \
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/cdr/buildfile b/xsd-examples/cxx/tree/binary/cdr/buildfile
index d78a56a..ccff659 100644
--- a/xsd-examples/cxx/tree/binary/cdr/buildfile
+++ b/xsd-examples/cxx/tree/binary/cdr/buildfile
@@ -13,9 +13,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-ostream \
--generate-insertion 'ACE_OutputCDR' \
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/binary/xdr/buildfile b/xsd-examples/cxx/tree/binary/xdr/buildfile
index 92f0c48..0fbab13 100644
--- a/xsd-examples/cxx/tree/binary/xdr/buildfile
+++ b/xsd-examples/cxx/tree/binary/xdr/buildfile
@@ -15,9 +15,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-ostream \
--generate-insertion 'XDR' \
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/caching/buildfile b/xsd-examples/cxx/tree/caching/buildfile
index cb369b7..f1bcb10 100644
--- a/xsd-examples/cxx/tree/caching/buildfile
+++ b/xsd-examples/cxx/tree/caching/buildfile
@@ -12,9 +12,7 @@ exe{driver}: {xml xsd}{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--output-dir $out_base \
$path($<[0])
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/compression/buildfile b/xsd-examples/cxx/tree/compression/buildfile
index 6997339..99dd8a6 100644
--- a/xsd-examples/cxx/tree/compression/buildfile
+++ b/xsd-examples/cxx/tree/compression/buildfile
@@ -11,9 +11,7 @@ exe{driver}: {hxx cxx}{* -library} {hxx ixx cxx}{library} $libs testscript
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--generate-ostream \
diff --git a/xsd-examples/cxx/tree/custom/calendar/README b/xsd-examples/cxx/tree/custom/calendar/README
index f7f6989..a4297ba 100644
--- a/xsd-examples/cxx/tree/custom/calendar/README
+++ b/xsd-examples/cxx/tree/custom/calendar/README
@@ -16,17 +16,29 @@ calendar.xml
Sample XML instance document.
xml-schema.hxx
- C++ types for XML Schema built-in types. This header file is generated
- by XSD using the --generate-xml-schema option. The --custom-type option
- is also used to customize the xsd:date type.
+ C++ types for XML Schema built-in types.
+
+ This header file is generated by the XSD compiler in the
+ --generate-xml-schema mode using the following command line:
+
+ xsd cxx-tree --generate-xml-schema --custom-type date \
+ --hxx-epilogue '#include "xml-schema-custom.hxx"' xml-schema.xsd
+
+ The --custom-type option is used to customize the xsd:date type.
calendar.hxx
calendar.ixx
calendar.cxx
C++ types that represent the given vocabulary and a set of parsing
functions that convert XML instance documents to a tree-like in-memory
- object model. These are generated by XSD from calendar.xsd with the
- --extern-xml-schema option in order to include xml-schema.hxx.
+ object model.
+
+ These files are generated by the XSD compiler from calendar.xsd using the
+ following command line:
+
+ xsd cxx-tree --extern-xml-schema xml-schema.xsd calendar.xsd
+
+ The --extern-xml-schema option is used to include xml-schema.hxx.
xml-schema-custom.hxx
Header file which defines our own xml_schema::date class. It is
@@ -42,6 +54,17 @@ driver.cxx
that constructs the object model from the input file. It then prints
the calendar events to STDERR.
-To run the example on the sample XML instance document simply execute:
+To compile and link the example manually from the command line we can use
+the following commands (replace 'c++' with your C++ compiler name):
+
+c++ -DXSD_CXX11 -c calendar.cxx
+c++ -DXSD_CXX11 -c xml-schema-custom.cxx
+c++ -DXSD_CXX11 -c driver.cxx
+c++ -o driver driver.o calendar.o xml-schema-custom.o -lxerces-c
+
+Note that we need to define the XSD_CXX11 preprocessor macro since the
+source code includes libxsd headers directly.
+
+To run the example on the sample XML instance document execute:
-$ ./driver calendar.xml
+./driver calendar.xml
diff --git a/xsd-examples/cxx/tree/custom/calendar/buildfile b/xsd-examples/cxx/tree/custom/calendar/buildfile
index 3c26122..3309f6f 100644
--- a/xsd-examples/cxx/tree/custom/calendar/buildfile
+++ b/xsd-examples/cxx/tree/custom/calendar/buildfile
@@ -16,9 +16,7 @@ exe{driver}: xml{calendar}: test.input = true
<{hxx ixx cxx}{calendar}>: xsd{calendar} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--extern-xml-schema xml-schema.xsd \
--output-dir $out_base \
@@ -27,12 +25,12 @@ exe{driver}: xml{calendar}: test.input = true
hxx{xml-schema}: $xsd
{{
- diag xsd gen ($>[0])
+ diag xsd $>
# Note that the specified xml-schema.xsd doesn't exist and is only used to
# deduce the generated header name.
#
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-xml-schema \
--custom-type date \
--hxx-epilogue '#include "xml-schema-custom.hxx"' \
diff --git a/xsd-examples/cxx/tree/custom/comments/README b/xsd-examples/cxx/tree/custom/comments/README
index 8fd69d0..32412db 100644
--- a/xsd-examples/cxx/tree/custom/comments/README
+++ b/xsd-examples/cxx/tree/custom/comments/README
@@ -16,9 +16,17 @@ people.xml
Sample XML instance document.
xml-schema.hxx
- C++ types for XML Schema built-in types. This header file is generated
- by XSD using the --generate-xml-schema option. The --custom-type option
- is also used to customize the xsd:anyType type.
+ C++ types for XML Schema built-in types.
+
+ This header file is generated by by the XSD compiler in the
+ --generate-xml-schema mode using the following command line:
+
+ xsd cxx-tree --generate-xml-schema \
+ --generate-serialization \
+ --custom-type anyType=/type_base \
+ --hxx-epilogue '#include "xml-schema-custom.hxx"' xml-schema.xsd
+
+ The --custom-type option is used to customize the xsd:anyType type.
people.hxx
people.ixx
@@ -26,9 +34,15 @@ people.cxx
C++ types that represent the person record vocabulary, a set of
parsing functions that convert XML instance documents to a tree-like
in-memory object model, and a set of serialization functions that
- convert the object model back to XML. These are generated by XSD
- from people.xsd with the --extern-xml-schema option in order to
- include xml-schema.hxx.
+ convert the object model back to XML.
+
+ These files are generated by the XSD compiler from people.xsd using the
+ following command line:
+
+ xsd cxx-tree --generate-serialization --extern-xml-schema xml-schema.xsd \
+ people.xsd
+
+ The --extern-xml-schema option in used to include xml-schema.hxx.
xml-schema-custom.hxx
Header file which defines our own xml_schema::type class. It is
@@ -52,6 +66,18 @@ driver.cxx
on this object model. Finally, it serializes the modified object
model back to XML, including XML comments.
-To run the example on the sample XML instance document simply execute:
+To compile and link the example manually from the command line we can use
+the following commands (replace 'c++' with your C++ compiler name):
+
+c++ -DXSD_CXX11 -c people.cxx
+c++ -DXSD_CXX11 -c xml-schema-custom.cxx
+c++ -DXSD_CXX11 -c dom-parse.cxx
+c++ -DXSD_CXX11 -c driver.cxx
+c++ -o driver driver.o people.o xml-schema-custom.o dom-parse.o -lxerces-c
+
+Note that we need to define the XSD_CXX11 preprocessor macro since the
+source code includes libxsd headers directly.
+
+To run the example on the sample XML instance document execute:
-$ ./driver people.xml
+./driver people.xml
diff --git a/xsd-examples/cxx/tree/custom/comments/buildfile b/xsd-examples/cxx/tree/custom/comments/buildfile
index 093a6cc..6edf81a 100644
--- a/xsd-examples/cxx/tree/custom/comments/buildfile
+++ b/xsd-examples/cxx/tree/custom/comments/buildfile
@@ -15,9 +15,7 @@ exe{driver}: xml{people}: test.input = true
<{hxx ixx cxx}{people}>: xsd{people} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--extern-xml-schema xml-schema.xsd \
@@ -27,12 +25,12 @@ exe{driver}: xml{people}: test.input = true
hxx{xml-schema}: $xsd
{{
- diag xsd gen ($>[0])
+ diag xsd $>
# Note that the specified xml-schema.xsd doesn't exist and is only used to
# deduce the generated header name.
#
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-xml-schema \
--generate-serialization \
--custom-type anyType=/type_base \
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 190306c..51e9c99 100644
--- a/xsd-examples/cxx/tree/custom/contacts/buildfile
+++ b/xsd-examples/cxx/tree/custom/contacts/buildfile
@@ -12,13 +12,11 @@ exe{driver}: xml{contacts}: test.input = true
<{hxx ixx cxx}{contacts}>: xsd{contacts} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
- --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/double/buildfile b/xsd-examples/cxx/tree/custom/double/buildfile
index 258191a..0c33afe 100644
--- a/xsd-examples/cxx/tree/custom/double/buildfile
+++ b/xsd-examples/cxx/tree/custom/double/buildfile
@@ -13,9 +13,7 @@ exe{driver}: {hxx cxx}{* -order -xml-schema} \
<{hxx ixx cxx}{order}>: xsd{order} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--extern-xml-schema xml-schema.xsd \
@@ -25,12 +23,12 @@ exe{driver}: {hxx cxx}{* -order -xml-schema} \
hxx{xml-schema}: $xsd
{{
- diag xsd gen ($>[0])
+ diag xsd $>
# Note that the specified xml-schema.xsd doesn't exist and is only used to
# deduce the generated header name.
#
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-xml-schema \
--generate-serialization \
--custom-type double=double \
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/mixed/buildfile b/xsd-examples/cxx/tree/custom/mixed/buildfile
index 9da936e..e5919fe 100644
--- a/xsd-examples/cxx/tree/custom/mixed/buildfile
+++ b/xsd-examples/cxx/tree/custom/mixed/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{people}: test.input = true
<{hxx ixx cxx}{people}>: xsd{people} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--custom-type bio=/bio_base \
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>/person_base" \
+ --custom-type "superman=superman_impl<superman_base>/superman_base" \
+ --custom-type "batman=batman_impl<batman_base>/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/taxonomy/buildfile b/xsd-examples/cxx/tree/custom/taxonomy/buildfile
index 9267c68..4068daa 100644
--- a/xsd-examples/cxx/tree/custom/taxonomy/buildfile
+++ b/xsd-examples/cxx/tree/custom/taxonomy/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{people}: test.input = true
<{hxx ixx cxx}{people} hxx{people-fwd}>: xsd{people} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-forward \
--generate-polymorphic \
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/custom/wildcard/buildfile b/xsd-examples/cxx/tree/custom/wildcard/buildfile
index e386709..1bb5a8f 100644
--- a/xsd-examples/cxx/tree/custom/wildcard/buildfile
+++ b/xsd-examples/cxx/tree/custom/wildcard/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{wildcard}: test.input = true
<{hxx ixx cxx}{wildcard}>: xsd{wildcard} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--generate-ostream \
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/embedded/buildfile b/xsd-examples/cxx/tree/embedded/buildfile
index c8e7808..20b7207 100644
--- a/xsd-examples/cxx/tree/embedded/buildfile
+++ b/xsd-examples/cxx/tree/embedded/buildfile
@@ -17,9 +17,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--output-dir $out_base \
$path($<[0])
@@ -27,7 +25,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx cxx}{library-schema}>: xsd{library} exe{xsdbin}
{{
- diag xsdbin ($<[0]) # @@ TMP
+ diag xsdbin ($<[0]) -> $>
($<[1]) --output-dir $out_base $path($<[0])
}}
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/hello/buildfile b/xsd-examples/cxx/tree/hello/buildfile
index 241d6f1..1cd17ac 100644
--- a/xsd-examples/cxx/tree/hello/buildfile
+++ b/xsd-examples/cxx/tree/hello/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{hello}: test.input = true
<{hxx ixx cxx}{hello}>: xsd{hello} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--output-dir $out_base \
$path($<[0])
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/library/buildfile b/xsd-examples/cxx/tree/library/buildfile
index 4ab023b..03745fb 100644
--- a/xsd-examples/cxx/tree/library/buildfile
+++ b/xsd-examples/cxx/tree/library/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-ostream \
--generate-serialization \
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/messaging/buildfile b/xsd-examples/cxx/tree/messaging/buildfile
index 62fadda..7be8caf 100644
--- a/xsd-examples/cxx/tree/messaging/buildfile
+++ b/xsd-examples/cxx/tree/messaging/buildfile
@@ -10,9 +10,7 @@ exe{driver}: {hxx cxx}{* -protocol} {hxx ixx cxx}{protocol} $libs testscript
<{hxx ixx cxx}{protocol}>: xsd{protocol} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--root-element-all \
--generate-element-type \
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/mixed/buildfile b/xsd-examples/cxx/tree/mixed/buildfile
index 4c1be8e..c91021a 100644
--- a/xsd-examples/cxx/tree/mixed/buildfile
+++ b/xsd-examples/cxx/tree/mixed/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{text}: test.input = true
<{hxx ixx cxx}{text}>: xsd{text} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--output-dir $out_base \
$path($<[0])
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/multiroot/buildfile b/xsd-examples/cxx/tree/multiroot/buildfile
index dc10588..55ddb0d 100644
--- a/xsd-examples/cxx/tree/multiroot/buildfile
+++ b/xsd-examples/cxx/tree/multiroot/buildfile
@@ -10,9 +10,7 @@ exe{driver}: {hxx cxx}{* -protocol} {hxx ixx cxx}{protocol} $libs testscript
<{hxx ixx cxx}{protocol}>: xsd{protocol} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--root-element-all \
--output-dir $out_base \
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/element/buildfile b/xsd-examples/cxx/tree/order/element/buildfile
index eb3834e..6e56a60 100644
--- a/xsd-examples/cxx/tree/order/element/buildfile
+++ b/xsd-examples/cxx/tree/order/element/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{transactions}: test.input = true
<{hxx ixx cxx}{transactions}>: xsd{transactions} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--generate-wildcard \
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/order/mixed/buildfile b/xsd-examples/cxx/tree/order/mixed/buildfile
index 149bca0..6bc21e2 100644
--- a/xsd-examples/cxx/tree/order/mixed/buildfile
+++ b/xsd-examples/cxx/tree/order/mixed/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{text}: test.input = true
<{hxx ixx cxx}{text}>: xsd{text} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--ordered-type-mixed \
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/performance/buildfile b/xsd-examples/cxx/tree/performance/buildfile
index e9faeef..7b28308 100644
--- a/xsd-examples/cxx/tree/performance/buildfile
+++ b/xsd-examples/cxx/tree/performance/buildfile
@@ -14,9 +14,7 @@ exe{driver}: xml{test-50k}: test.input = true
<{hxx ixx cxx}{test}>: xsd{test} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--output-dir $out_base \
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/polymorphism/buildfile b/xsd-examples/cxx/tree/polymorphism/buildfile
index 754c6c2..359d4d3 100644
--- a/xsd-examples/cxx/tree/polymorphism/buildfile
+++ b/xsd-examples/cxx/tree/polymorphism/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{supermen}: test.input = true
<{hxx ixx cxx}{supermen}>: xsd{supermen} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-polymorphic \
--generate-serialization \
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/secure/buildfile b/xsd-examples/cxx/tree/secure/buildfile
index b1ca71f..a86af57 100644
--- a/xsd-examples/cxx/tree/secure/buildfile
+++ b/xsd-examples/cxx/tree/secure/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{library}: test.input = true
<{hxx ixx cxx}{library}>: xsd{library} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--output-dir $out_base \
$path($<[0])
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/streaming/buildfile b/xsd-examples/cxx/tree/streaming/buildfile
index 8c34b17..8555257 100644
--- a/xsd-examples/cxx/tree/streaming/buildfile
+++ b/xsd-examples/cxx/tree/streaming/buildfile
@@ -10,9 +10,7 @@ exe{driver}: {hxx cxx}{* -position} {hxx ixx cxx}{position} $libs testscript
<{hxx ixx cxx}{position}>: xsd{position} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-serialization \
--output-dir $out_base \
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/wildcard/buildfile b/xsd-examples/cxx/tree/wildcard/buildfile
index 5bc63c5..dc158f4 100644
--- a/xsd-examples/cxx/tree/wildcard/buildfile
+++ b/xsd-examples/cxx/tree/wildcard/buildfile
@@ -12,9 +12,7 @@ exe{driver}: xml{email}: test.input = true
<{hxx ixx cxx}{email}>: xsd{email} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--generate-wildcard \
--generate-serialization \
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
diff --git a/xsd-examples/cxx/tree/xpath/buildfile b/xsd-examples/cxx/tree/xpath/buildfile
index c6f090a..4f49599 100644
--- a/xsd-examples/cxx/tree/xpath/buildfile
+++ b/xsd-examples/cxx/tree/xpath/buildfile
@@ -13,9 +13,7 @@ exe{driver}: xml{people}: test.input = true
<{hxx ixx cxx}{people}>: xsd{people} $xsd
{{
- diag xsd ($<[0]) # @@ TMP
-
- $xsd cxx-tree --std c++11 \
+ $xsd cxx-tree \
--generate-inline \
--output-dir $out_base \
$path($<[0])