Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: different whitespace-collapse behaviour of parsers

From: "Michael Kay" <mike@--------.--->
To: "'Dieter Guthmann'" <mailing-deg@-------.-->, <xmlschema-dev@--.--->
Date: 3/13/2009 8:29:00 AM
The specification is a little bit less formal than one might like:

replace
    All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
are replaced with #x20 (space) 
collapse
    After the processing implied by replace, contiguous sequences of #x20's
are collapsed to a single #x20, and leading and trailing #x20's are removed.


and I guess one could argue for an interpretation that says a character
can't be a "leading #x20" unless it is followed by something - but it seems
a bit far-fetched to me. I think Liquid XML Studio is out on a limb here.
But I've raised bug 6695 to propose a clarification.

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

> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Dieter Guthmann
> Sent: 12 March 2009 16:35
> To: xmlschema-dev@w...
> Subject: different whitespace-collapse behaviour of parsers
> 
> Hi,
> 
> I've tested a few XML-Parsers/Validators and discovered that 
> the restriction "whiteSpace=collapse" [1] is interpreted in 
> two different ways.
> 
> "Liquid XML Studio 2009" treats a whitespace-only string 
> within a tag not as trailing/leading whitespace [1]:
> "<tag>    \n   </tag>" will be transformed in "<tag> </tag>" before
> validation (or it seems so),
> whereas the other parsers I've tested (Altova XMLSpy">XMLSpy, 
> XMLmind XML Editor, W3C XSV) will transform
> "<tag>    \n   </tag>" to "<tag></tag>"
> 
> Which behaviour is the correct one? See below for a schema example.
> 
> Best Regards,
> Dieter Guthmann
> 
> [1] 
> <http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#rf-whiteSpace>
> 
> Below an Example:
> ------- begin mysschema.xsd -------
> <?xml version="1.0" encoding="utf-8" ?>
> <xs:schema elementFormDefault="qualified"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:simpleType name="nocontent">
>     <xs:restriction base="xs:string">
>       <xs:whiteSpace value="collapse" />
>       <xs:pattern value="" />
>       <!-- This line above will not work in  Liquid XML... 
> replace "value" with "[ ]" and it will work -->
>     </xs:restriction>
>   </xs:simpleType>
>   <xs:element name="customerdatabase">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element ref="customer" />
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
>   <xs:element name="customer">
>     <xs:complexType>
>       <xs:simpleContent>
>         <xs:extension base="nocontent">
>           <xs:attribute name="name" type="xs:string" />
>         </xs:extension>
>       </xs:simpleContent>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> ------- end myschema.xsd -------
> 
> ------- begin myxmlfile.xml -------
> <?xml version="1.0" encoding="UTF-8"?>
> <customerdatabase 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="myschema.xsd">
>   <customer name="test">
>   </customer>
> </customerdatabase>
> ------- end myxmlfile.xml -------
> 
> 
> 


From robert.melskens@g... Wed Mar 18 15:07:01 2009
Received: from farnsworth.w3.org ([128.30.52.43] helo=wiggum.w3.org)
	by frink


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent