RE: whiteSpace facet

See XML Schema Part 2 sectoin 4.3.6:
 
whiteSpace is applicable to all
<http://www.w3.org/TR/xmlschema-2/#dt-atomic> .atomic. and
<http://www.w3.org/TR/xmlschema-2/#dt-list> .list. datatypes. For all
<http://www.w3.org/TR/xmlschema-2/#dt-atomic> .atomic. datatypes other than
<http://www.w3.org/TR/xmlschema-2/#string> string (and types
<http://www.w3.org/TR/xmlschema-2/#dt-derived> .derived. by
<http://www.w3.org/TR/xmlschema-2/#dt-restriction> .restriction. from it)
the value of whiteSpace is collapse and cannot be changed by a schema
author; for  <http://www.w3.org/TR/xmlschema-2/#string> string the value of
whiteSpace is preserve; for any type
<http://www.w3.org/TR/xmlschema-2/#dt-derived> .derived. by
<http://www.w3.org/TR/xmlschema-2/#dt-restriction> .restriction. from
<http://www.w3.org/TR/xmlschema-2/#string> string the value of whiteSpace
can be any of the three legal values. For all datatypes
<http://www.w3.org/TR/xmlschema-2/#dt-derived> .derived. by
<http://www.w3.org/TR/xmlschema-2/#dt-list> .list. the value of whiteSpace
is collapse and cannot be changed by a schema author. 
 
And the schema for schema documents:
 
  <xs:simpleType name="normalizedString" id="normalizedString">

    <xs:annotation>

      <xs:documentation

           source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>

    </xs:annotation>

    <xs:restriction base="xs:string">

      <xs:whiteSpace value="replace" id="normalizedString.whiteSpace"/>

    </xs:restriction>

  </xs:simpleType>
  <xs:simpleType name="token" id="token">

    <xs:annotation>

      <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#token"/>

    </xs:annotation>

    <xs:restriction base="xs:normalizedString">

      <xs:whiteSpace value="collapse" id="token.whiteSpace"/>

    </xs:restriction>

  </xs:simpleType>
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Shlomo Yona
Sent: 18 November 2007 17:48
To: xmlschema-dev@w3.org
Subject: whiteSpace facet



Hello,

 

My questions are regarding White Space Normalization during Validation
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#d0e1654.

 

1.	Is there a "default" value for the whiteSpace facet for xsd:string,
xsd:normalizedString and xsd:token? 

2.	What is the value of the whiteSpace facet for xsd:string? I assumed
it was 'preserve'. Is it? 

3.	What is the value of the whiteSpace facet for xsd:normalizedString?
I assumed it was 'replace'. Is it? 

4.	What is the value of the whiteSpace facet for xsd:token? I assumed
it was 'collapse'. Is it? 

 

For example, if I have an element of type xsd:normalizedString and in the
XML instance the value of that element contains newline characters should I:

a.	Expect an error/warning because the newline character is not in the
lexical space of xsd:normalizedString? 

b.	Expect the newline to be replaced with a space before validation
proceeds? 

c.	Something else? 

 

I'd go for "a" if the (implied?) "default" value for the whiteSpace facet
was "preserve".

I'd go with "b" if the answer for question #3 was that the value is (or is
implied to be) "replace".

 

But I just don't know.

 

Can you please point to the relevant section(s) in the XML Schema 1.0
recommendation that supports your answer?

 

Thank you.

 

Shlomo.

Received on Sunday, 18 November 2007 22:35:27 UTC