Well, I'm not sure I understand the spec fully on this point, but I
think you need to specify a value for the whiteSpace facet
(whiteSpace="collapse") in your schema.  whiteSpace is among token's
constraining facets, but I don't see any indication that its default
value is collapse.  The Schema spec says, "for string the value of
whiteSpace is preserve; for any type *derived* by *restriction* from
string the value of whiteSpace can be any of the three legal values."
Token is derived (via normalizedString) from string, so the initial
value of whiteSpace would appear to be "preserve."

I reviewed the spec briefly, though, so I may have missed something.

-----Original Message-----
From: Matt Dillard [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 05, 2004 5:17 PM
To: [EMAIL PROTECTED]
Subject: Whitespace normalization issue

I understand the whitespace facet to be a directive to the parser
regarding how to deal with whitespace.  If the whitespace facet is set
to "collapse", as it is in an xsd:token, then the following tag is
legal:
<MyToken>This is my token       </MyToken>
The parser will read it in, collapse the whitespace, and then validate
the data.

That said, this doesn't seem to be the behavior I'm getting from Xerces,
or from other online validators either, for that matter. 
Below is a sample schema:

<?xml version="1.0" ?>
<xsd:schema xmlns="xyz"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema";
      targetNamespace="xyz">
  <xsd:element name="Tag" type="xsd:token" /> </xsd:schema>

and a corresponding instance document:

<?xml version="1.0" ?>
<Tag xmlns="xyz">My token    </Tag>

This instance document will not validate in Xerces, and it won't
validate at any of the online validators I've checked, either (including
http://tools.decisionsoft.com/schemaValidate.html and
http://apps.gotdotnet.com/xmltools/xsdvalidator/ ).  If I remove the
trailing whitespace, the file validates just fine.

Is my understanding of the whitespace facet incorrect, or is something
else going on here?

Thanks,
Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to