From 741bfb659caaa771c748d03df26792fab10e5778 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 26 Sep 2023 10:43:31 +0200 Subject: Add XSD and C++ compiler command lines to example READMEs --- xsd-examples/cxx/tree/compression/README | 38 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'xsd-examples/cxx/tree/compression') 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. -- cgit v1.1