Jesse, There is actually a code snippet showing how token is defined in section 4.3.6 of the spec (http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#rf-whiteSpace). Token has the "collapse" value set for the whiteSpace facet.
I also find that if I have a value declared of type xsd:integer, for instance, I get an error when I have a tag that looks like this: <MyInt> 6</MyInt> The default whiteSpace constraint for most element types is "collapse", so the above should validate just fine. The parser should first collapse the data, and then send it through the validator. This first step of collapsing whitespace does not seem to be happening. Matt On Fri, 6 Aug 2004 11:08:30 -0400, Jesse Pelton <[EMAIL PROTECTED]> wrote: > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]