[xsd-users] Q on Binary Serialization

Boris Kolpackov boris at codesynthesis.com
Wed Feb 20 13:34:21 EST 2008


Hi Shiva,

Balasubramanyam, Shivakumar <sbalasub at qualcomm.com> writes:

> For example, let's say I have a userid that would represent 20 bits in
> the wire format. I was thinking, I could define xsd data type called
> bits which would have length as the wire format.
>
> 2.	Any generic XSD datatypes to represent the same?

There are no XML Schema types that represent bit sets (it would be a
somewhat unnatural type for text-based XML). The closest you can get
is by using base64Binary or hexBinary though for smaller bit sets it
would probably be more economical to use byte, short, int, or long.

Once you derive a type from base64Binary or hexBinary, you can use
type customization to completely override XML and/or binary
parsing and serialization code for this type which allows you to
choose pretty much any over-the-wire representation you like.

Boris




More information about the xsd-users mailing list