Re: [xml] xmlSchema : problem with the 'token' datatype ?
- From: Kasimier Buchcik <kbuchcik 4commerce de>
- To: GUY Fabrice <fabrice guy gmail com>
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] xmlSchema : problem with the 'token' datatype ?
- Date: Wed, 11 May 2005 15:37:48 +0200
Hi,
On Wed, 2005-05-11 at 13:31 +0200, GUY Fabrice wrote:
Hi,
I have this schema :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="element" type="xsd:token"/>
</xsd:schema>
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:
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#d0e1654
http://www.w3.org/TR/xmlschema-2/#dt-whiteSpace
http://www.w3.org/TR/xmlschema-2/#built-in-datatypes
Regards,
Kasimier (or Kasiemir as Daniel thinks my name is :-D)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]