hexBinary minLength Bug or Feature?

D

Don Adams

I have this defined in my schema:
<xsd:simpleType name="addressType">
<xsd:restriction base="xsd:hexBinary">
<xsd:minLength value="1"/>
<xsd:maxLength value="8"/>
</xsd:restriction>
</xsd:simpleType>

I was hoping this would allow values to be entered
like "00" and "FFFFFFFFFFFFFFFF"; however,
what I'm finding with oXygen and Xerces is that
only values like "0000000000000000" and "FFFFFFFFFFFFFFFF"
are being allowed. In other words, I'm required to type all 16 digits of the
maxLength-sized hex number in order to be valid.

Is this correct behavior for minLength and maxLength of a hexBinary value?
Maybe I'm trying to use hexBinary incorrectly.
 
D

Don Adams

I found the problem. I was testing values against minLength
and maxLength that had an odd number of digits. For example, "0"
instead of "00" and "123" instead of "1234". It does work correctly
when the test value has an even number of digits.

I was thinking that hexBinary was a way to enter integers in hex format,
but that isn't quite right. I think I will use this instead:

<xsd:simpleType name="hexstringType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0123456789abcdefABCDEF]*"/>
</xsd:restriction>
</xsd:simpleType>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top