Thank you for the answer.
So "whiteSpace='preserve'" facet could not preserve any line feed in an
attribute's value. Am I understanding this right?
Good luck!
Vitaly
Michael Glavassevich wrote:
Vitaly,
XML parsers are required to normalize [1] attribute values. The line feed
would be substituted with a space (i.e. 0x20) before the schema validator
sees it.
Thanks.
[1] http://www.w3.org/TR/2006/REC-xml-20060816/#AVNormalize
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [email protected]
E-mail: [email protected]
Vitaly Prapirny<[email protected]> wrote on 08/27/2010 10:50:13 AM:
Greetings,
Could someone please enlighten me on why these document had been
validated without error? Shouldn't the line feed be preserved when
validating the 'd' attribute so that the pattern check fails?
======= b.xml =============
<?xml version="1.0"?>
<e xmlns="e" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="e a.xsd" d="k
"/>
===========================
======= a.xsd =============
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="e"
targetNamespace="e">
<xs:simpleType name="a">
<xs:restriction base="xs:string">
<xs:pattern value="[ ]*[!-~][ -
~]*"/>
<xs:whiteSpace value="preserve"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="c">
<xs:attribute name="d" type="e:a">
</xs:attribute>
</xs:complexType>
<xs:element name="e" type="e:c"/>
</xs:schema>
===========================
Good luck!
Vitaly