Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - alternative obligatory attributes >Thread Next - RE: different whitespace-collapse behaviour of parsers different whitespace-collapse behaviour of parsersTo: xmlschema-dev@--.--- Date: 3/12/2009 6:35:00 PM 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 mike@s... Fri Mar 13 08:30:11 2009 Received: from bart.w3.org ([128.30.52.63]) by frink | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
