W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2004

RE: Lexial and value space in context of pattern, enum and whitespace

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Tue, 20 Apr 2004 07:09:28 -0400
To: "'Florian Reuter'" <flr@informatik.uni-kiel.de>, <xmlschema-dev@w3.org>
Message-Id: <20040420110940.36A04A50BB@frink.w3.org>

Hi Florian,

Both of your examples are valid.  Whitespace normalization takes place
before any validation, so the string "a" would be what is matched to the
pattern in the first case.  


The Structures part of the rec defines normalized value in [1] as:

[Definition:]  The normalized value of an element or attribute information
item is an ˇinitial valueˇ whose white space, if any, has been normalized
according to the value of the whiteSpace facet of the simple type definition
used in its ˇvalidationˇ: 


It later goes on to say (in Element Locally Valid (Type) [2], clause 3.1.3):

"...the ˇnormalized valueˇ must be ˇvalidˇ with respect to the type
definition as defined by String Valid (§3.14.4). 

So it is the whitespace-normalized value ("a") that is validated, not the
initial value (" a ").

Hope that helps!
Priscilla

[1]
http://www.w3.org/TR/xmlschema-1/#section-White-Space-Normalization-during-V
alidation
[2] http://www.w3.org/TR/xmlschema-1/#cvc-type 

-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
-----------------------------------------------------  

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Florian Reuter
> Sent: Tuesday, April 20, 2004 6:45 AM
> To: xmlschema-dev@w3.org
> Subject: Lexial and value space in context of pattern, enum 
> and whitespace 
> 
> 
> 
> Hello,
> 
> I have a question concerning the XSD simple types.
> Consider the following simple type definition
>  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:element name="test">
>  <xsd:simpleType>
>  <xsd:restriction base="xsd:string">
>  <xsd:whiteSpace value="collapse"/>
>  <xsd:pattern value="a"/>
>  </xsd:restriction>
>  </xsd:simpleType>
>  </xsd:element>
>  </xsd:schema>
> I expect the content <test> a </test> to be *invalid* with 
> respect to the
> above definition, because according to the schema spec:
> a) whiteSpace constrains the *value space*, and
> b) pattern is a constraint on the *value space* of a datatype which is
> achieved by constraining the *lexical space* to literals which match a
> specific pattern
> 
> On the other hand I expect the content <test> a </test> to be 
> *valid* with
> respect to the following schema
>  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:element name="test">
>  <xsd:simpleType>
>  <xsd:restriction base="xsd:string">
>  <xsd:whiteSpace value="collapse"/>
>  <xsd:enumeration value="a"/>
>  </xsd:restriction>
>  </xsd:simpleType>
>  </xsd:element>
>  </xsd:schema>
> because according to the schema spec an
> c) enumeration constrains the *value space* to a specified 
> set of values
> 
> 
> Can anyone help me clarify this - or even better - point me 
> to a formal
> semantic of the datatype definition?
> 
> Best regards,
> 
> Florian 
> 
> 
Received on Tuesday, 20 April 2004 07:09:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:11 UTC