W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2002

Re: Hex Expression

From: Michael Rossi <mrossi@csc.com>
Date: Mon, 12 Aug 2002 15:03:23 -0400
To: xmlschema-dev@w3.org
Message-ID: <OF791B7120.47AA007B-ON85256C13.0067E844@com>


     Thanks Jeni. You're explanation actually confirms my suspicions. You
see this value is being used merely as an identifier, not a numeric
quantity of some sort. So I really do just want 16 hexadecimal (read,
coincidentally base-16) digits. Since an application might (would/should)
be mislead by a type definition of hexBinary, I thought it best to stick
with a user-defined type.

Michael A. Rossi
Computer Sciences Corporation
mailto:mrossi@csc.com
856-983-4400 x4964


                                                                                                                   
                    Jeni Tennison                                                                                  
                    <jeni@jenitenn                                                                                 
                    ison.com>                                                                                      
                                                                                                                   


Hi Michael,

<snip/>

As I understand it, an application will internally store the value of
an xs:hexBinary node as the bytes that the hex encoding signifies, so
obviously the storage requirements will be a lot less than it storing
the characters representing the hex encoding of that stream
(especially when you consider that the internal character encoding of
the application is likely to be UTF-16, using 2 bytes for each
character, so each actual byte ends up being represented internally in
4 bytes). If you're only using small sets of data, that probably
doesn't matter, though.

I'm not clear why you don't want to use xs:hexBinary as the data type
for your node. It would provide you with your regexp checking for
free, and it sounds as though it's more accurate to say that the value
*is* hex rather than that it *is* a sequence of characters.

The equivalent of:

<xs:simpleType name="8bytes">
  <xs:restriction base="xs:token">
    <xs:pattern value="[0-9a-fA-F]{16}" />
  </xs:restriction>
</xs:simpleType>

is:

<xs:simpleType name="8bytes">
  <xs:restriction base="xs:hexBinary">
    <xs:length value="8" />
  </xs:restriction>
</xs:simpleType>

if you want to change it.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Monday, 12 August 2002 15:04:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT