A
Andrey Brozhko
Hi
I need to represent custom type system (ints, bytes, chars, enums,
bitmasks, arrays and some other types) in xml. It is easy to see how to
represent enums in xml (using xs:enumeration), the same is true for
numeric types. Even arrays have an obvious description in schema:
<complexType name="IntArray">
<sequence>
<element name="item" type="int" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
But how about bitmasks? What's the most beautiful way to represent a
bitmask where values have names? It's just like enumeration but the
value at any time can be a disjunction of any number of valid names.
For example: if we have x = 0x01, y = 0x02 etc then the value may be
either x, or x|y, or y etc.. but it can not be specified with 0x01. I
don't think having "<myAttribute>x|y</myAttribute>" in the xml document
is a good idea. Any suggestions?
Cheers,
Kapitan
I need to represent custom type system (ints, bytes, chars, enums,
bitmasks, arrays and some other types) in xml. It is easy to see how to
represent enums in xml (using xs:enumeration), the same is true for
numeric types. Even arrays have an obvious description in schema:
<complexType name="IntArray">
<sequence>
<element name="item" type="int" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
But how about bitmasks? What's the most beautiful way to represent a
bitmask where values have names? It's just like enumeration but the
value at any time can be a disjunction of any number of valid names.
For example: if we have x = 0x01, y = 0x02 etc then the value may be
either x, or x|y, or y etc.. but it can not be specified with 0x01. I
don't think having "<myAttribute>x|y</myAttribute>" in the xml document
is a good idea. Any suggestions?
Cheers,
Kapitan