W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2003

Are all values stored as strings?

From: Roger L. Costello <costello@mitre.org>
Date: Fri, 09 May 2003 16:50:22 -0400
Message-ID: <3EBC148E.440C1DC9@mitre.org>
To: xmlschema-dev@w3.org, "Costello,Roger L." <costello@mitre.org>

Hi Folks,

Consider these two ways of defining an element called "num":

-----------------------------------------------------------------
Version #1:

<xsd:element name="num" type="xsd:unsignedByte"/>

-----------------------------------------------------------------
Version #2:

<xsd:simpleType name="numType">
    <xsd:restriction base="xsd:string">
       <xsd:pattern 
          value="[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]"/>
   </xsd:restriction>
</xsd:simpleType>

<xsd:element name="num" type="numType

-----------------------------------------------------------------
Now, here is an example of an instance of "num":

<num>32</num>

Question: is it correct that num's value (32) is always represented as a
"string", regardless of how num is declared?  That is, are all values
just strings, with a "datatype label" associated with the string?

Let me ask it another way, is the value (32) represented by an XML
Schema validator as this:

   0010 0000

if "num" is declared using Version #1

and like this: 

   0011 0010

if "num" is declared using Version #2?

/Roger
Received on Friday, 9 May 2003 19:44:18 GMT

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