[xsd-users] Query about using Binary in-memory format to pass between applications

Boris Kolpackov boris at codesynthesis.com
Tue Oct 16 05:36:59 EDT 2007


Hi Tim,

Tim Parker <Tim.Parker at intecbilling.com> writes:

> I am new to this group so apologies if this has already been asked but I
> would like to know if the in-memory representation of XML data can be
> written to a file or streamed to another application and if so is this
> format an internal one or is it up to the developer to build this?

You can use the binary serialization/extraction feature which allows
you two write/read the in-memory representation to/from data
representation streams. This feature is designed in an open-ended
way which allows you to plug in your own data formats by simply providing
serialization/extraction code for basic types (e.g., int, string, etc).

There is also a number of commonly used data representation formats
supported out of the box (that is, the XSD runtime provided the
serialization/extraction code for basic types for these formats).
These include CDR (uses ACE CDR streams) and XDR (uses Sun's XDR
interface).

There is the 'binary' example in the examples/cxx/tree/ directory
that shows how to read/write the in-memory representation from/to
binary representation using ACE CDR streams. An example for XDR
will be included in the next release of XSD. If you would like I
can provide one for the current version.

There is also the sample code for supporting Boost archives that was
contributed by one of XSD users but is not yet part of the XSD
distribution.


> Basically we are looking for a way to use XML to represent data but due
> to the volumes it is not practical to pass data around in an XML format
> due to the size and the processing overhead of parsing the XML data each
> time but if we can convert the XML to a binary representation this would
> remove the processing overhead and hopefully reduce the size of the XML
> data packets.

Yes, you can definitely do that. In fact, quite a few people are using
binary serialization in exactly the same way and for exactly the same
reasons.

Boris




More information about the xsd-users mailing list