[xsd-users] base64_binary compression

Andrej Vasilj andrej_vasilj at hotmail.com
Mon Sep 22 20:58:47 EDT 2014


Thanks for the detailed reply Boris! I'll try to implement the modifications to the base64 type in the next days and let you know how it goes.

Cheers

--- Original Message ---

From: "Boris Kolpackov" <boris at codesynthesis.com>
Sent: 22 September, 2014 1:34 AM
To: "Andrej Vasilj" <andrej_vasilj at hotmail.com>
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] base64_binary compression

Hi Andrej,

Andrej Vasilj <andrej_vasilj at hotmail.com> writes:

> I just started using xsd and I am really enjoying it.

Thanks, glad to hear that!


> However, in the mzML format I am currently working with there is a
> base64_binary entry which I would like to compress (either with
> zlib or something else). I do not immediately see how I can
> accomplish this. Does anybody know how?
>
> When I create an instance of the binary_type, XSD automatically
> encodes my double * array to base64, and then automatically
> serializes it into the xml output. Is there anyway to intervene
> in this process and provide the already compressed base64 data?

You can accomplish this pretty easily with type customization. See
the C++/Tree Mapping Customization Guide:

http://wiki.codesynthesis.com/Tree/Customization_guide

As well as the examples in the examples/cxx/tree/custom/ directory.

There are two ways that you can approach this: If it is all the
base64_binary elements/attributes in your vocabulary that you
want to compress, then you would customize base64_binary itself.

If, however, it is only a specific element/attribute of the
base64_binary type that you want compressed, then your would
customize the complex type that contains this element/attribute
and compress the data in the serialization operator and de-
compress it in the parsing constructor.

Finally, there is the 'compression' example that shows how
to compress the whole document with zlib.

Boris



More information about the xsd-users mailing list