Re: [xml] xmlSchema : problem with the 'token' datatype ?


On Wed, 2005-05-11 at 13:31 +0200, GUY Fabrice wrote:

I have this schema :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="";>
  <xsd:element name="element" type="xsd:token"/>

And for example the xml file :
<?xml version="1.0" encoding="ISO-8859-1"?>
<element>       test</element>

And with xmllint (version 2.6.19) this document validates (although
the value of <element> begins with spaces).
It seems that the value of this 'token' element is corrected before
validating it (using xmlSchemaCollapseString). Is this behaviour
correct ?

Yes, the behaviour is correct. xs:token has a whitespace facet with
a value of "collapse", so all leading- and trailing whitespace is
removed, plus all adjacent whitespace characters are collapsed into
a single space character; this happens prior to any validation.
Actually, out of the built-in types only xs:string and
xs:normalizedString have a whitespace value other than "collapse".

Some relevant links:  


Kasimier (or Kasiemir as Daniel thinks my name is :-D)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]