1This example shows how to compress an XML document during serialization 2and decompress it during parsing. The example uses the compression 3functionality provided by the zlib library[1] which needs to be installed 4in order to build and run this example. It should also be fairly straight- 5forward to modify the code in this example to use other compression 6libraries. 7 8[1] http://www.zlib.net 9 10The example consists of the following files: 11 12library.xsd 13 XML Schema which describes a library of books. 14 15library.xml.gz 16 Sample XML instance document compressed using the gzip format. 17 18compressed-format-target.hxx 19compressed-format-target.cxx 20 Implementation of the Xerces-C++ XMLFormatTarget interface with the on- 21 the-fly compression support. You can use it in your application to add 22 XML compression. 23 24compressed-input-source.hxx 25compressed-input-source.cxx 26 Implementation of the Xerces-C++ InputSource interface with the on-the- 27 fly decompression support. You can use it in your application to add 28 XML decompression. 29 30library.hxx 31library.cxx 32 C++ types that represent the given vocabulary and a set of parsing 33 functions that convert XML instance documents to a tree-like in-memory 34 object model. These are generated by XSD from library.xsd. 35 36driver.cxx 37 Driver for the example. It first creates the compressed_input_source 38 object and passes it to one of the parsing functions that constructs 39 the object model from the compressed input file. It then prints the 40 content of the object model to STDERR. Finally, the driver creates the 41 compressed_format_target object and passes it to one of the serialization 42 functions which converts the object model back to the compressed XML. 43 44To run the example on the sample XML document simply execute: 45 46$ ./driver library.xml.gz 47 48The serialization output is written to the out.xml.gz file. 49