[xsde-users] Example of using hexBinary with XSDe hybrid

Boris Kolpackov boris at codesynthesis.com
Fri Dec 10 06:32:23 EST 2010


Hi Terry,

O'Laughlin, Terry <Terry.O'Laughlin at ipc.com> writes:

> I'm trying to figure out how to serialize and parse using the XML 
> type hexBinary.  Sort of confusing to me.  I'm trying to transmit 
> a 'bitMask' about 5-6 bytes long which shows an equipment configuration.
> I see the XSDe documentation shows that the XML buffer class is used 
> as the interface, but not sure how to use the methods of this class. 
> Not sure what primitive data class, string, char *, int, unsigned bytes,
> etc. that I can use to place data into this buffer.

The xml_schema::buffer class is a simple wrapper for the raw data
buffer concept. Here is how you can use it:

char* data = ... // some data
size_t data_size = ... // number of bytes in data

xml_schema::buffer b (data, data_size); // 'b' now has a copy of data

char* p = b.data ();
size_t n = b.size ();

assert (n == data_size);
assert (memcmp (data, p, n) == 0);

Boris



More information about the xsde-users mailing list