[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Is a token element with a carriage return, or leading/trailing spaces, valid?

From: Costello, Roger L. <costello@mitre.org>
Date: Thu, 15 Feb 2007 14:37:25 -0500
Message-ID: <B8415163A689094689542C617ECA0366016653C1@IMCSRV5.MITRE.ORG>
To: <xmlschema-dev@w3.org>
RE: Is a token element with a carriage return

 
Thanks Michael and Jerry.

I looked at the datatypes schema, and I see how the token datatype has
been defined with whitespace set to collapse.  I understand why my
examples should validate.

This spawns another question.

Consider these two declarations for element Title:

      <element name="Title" type="token"/>

      <element name="Title" type="string"/>

Consider an instance of Title:

      <Title>_______</Title>

Any value that I put in will yield the same validation results,
regardless of whether Title was declared to be of type token or string.
For example, this yields "valid"

      <Title>My Life and 
      Times</Title>

for both declarations.  And this yields "invalid"

      <Title>&#x0;</Title>

for both declarations.

Aren't the two declarations identical?  In fact, aren't they also
identical to this:

      <element name="Title" type="normalizedString"/>

Under what cases do they differ? (e.g., it yields "valid" when of type
string, but "invalid" when of type token)

/Roger


-----Original Message-----
From: Michael Kay [mailto:mike@saxonica.com] 
Sent: Thursday, February 15, 2007 11:35 AM
To: Costello, Roger L.; xmlschema-dev@w3.org
Subject: RE: Is a token element with a carriage return, or
leading/trailing spaces, valid?

These instances are valid.

People often misread this bit of the spec, because it's very badly
written.
What isn't immediately clear is that when it talks about the lexical
space
of the data type, that isn't the value as it appears in your source
document, it's the value after applying any processing implied by the
whitespace facet. In this case, applying the whitespace facet creates a
value that satisfies the rules for the lexical space.

The fact that xs:token is such a ridiculous misnomer for this data type
doesn't help...

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Costello, Roger L.
> Sent: 15 February 2007 15:48
> To: xmlschema-dev@w3.org
> Subject: Is a token element with a carriage return, or 
> leading/trailing spaces, valid?
> 
> 
> Hi Folks,
>  
> Consider this element declaration:
>  
>       <element name="Title" type="token"/>
> 
> And consider these two instances of the element:
> 
>       <Title>My Life and 
>       Times</Title>
> 
>       <Title> My Life and Times </Title>
> 
> In the first instance, the data has a carriage return.
> 
> In the second instance, the data has leading and trailing spaces.
> 
> Are the instances valid or invalid?
> 
>     XML Spy says they are invalid.
> 
>     Oxygen XML says they are valid.
> 
> Which is correct?
> 
> /Roger
> 
Received on Thursday, 15 February 2007 19:37:40 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.