summaryrefslogtreecommitdiff
path: root/xsd-examples/cxx/tree/compression
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-examples/cxx/tree/compression')
-rw-r--r--xsd-examples/cxx/tree/compression/README38
-rw-r--r--xsd-examples/cxx/tree/compression/buildfile4
2 files changed, 29 insertions, 13 deletions
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 \