[xsd-users] Removing whitespace from xml document

Boris Kolpackov boris at codesynthesis.com
Fri Sep 18 03:46:31 EDT 2009


Hi Simon,

[I CC'ed xsd-users in case others are interested in this.]

PICKUP Simon <simon at thinkresearch.co.uk> writes:

> I did expect this process to actually decrease the size of my xml 
> output - it hasn’t. It has however successfully removed all the 
> whitespace and tabs.

It probably did decrease the size, just no significantly. There a
few more things that you can do or may want to consider:

1. If your schemas use attributes with default values heavily, then
   you may want to omit them from the output XML. To do this you will
   need to recompile your schemas with the --omit-default-attributes
   option.

2. You may want to consider compressing the resulting XML before
   storage or over-the-wire transfer. This can be done on the fly
   with a compression library (e.g., zlib) and custom Xerces-C++
   InputSource and XMLFormatTarget implementations.

3. You may want to consider using binary serialization of XML for
   storage or over-the-wire transfer. This will work well if both the
   producer and consumer of your XML are using the XSD-generated object
   model (or you can convert from binary to the XML representation as
   required). See Section 5.2, "Binary Serialization" in the C++/Tree
   Mapping User Manual for more information:

   http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#5.2


Boris




More information about the xsd-users mailing list