W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2012

Restrict <CRLF> to the value \r\n ... the instance is <CRLF>\r\n</CRLF> ... error on validation -- why?

From: Costello, Roger L. <costello@mitre.org>
Date: Wed, 24 Oct 2012 12:55:10 +0000
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <B5FEE00B53CF054AA8439027E8FE17751E6924D5@IMCMBX04.MITRE.ORG>
Hello Folks,

The following schema declares two ENTITIES, one for carriage return and one for line feed. And then it restricts the value of the <CRLF> element by referencing those ENTITIES.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xs:schema [
<!ENTITY CR "&#13;">
<!ENTITY LF "&#10;">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="Test">
                <xs:element name="CRLF" maxOccurs="unbounded">
                        <xs:restriction base="xs:string">
                            <xs:pattern value="&CR;&LF;"/>


In an instance document the value of <CRLF> should be a carriage return followed by a line feed, right?

<?xml version="1.0" encoding="UTF-8"?>

However, when I validate that instance document I get this error message:

    The content "\r\n" of element <CRLF> does not match 
    the required simple type. Value "\r\n" contravenes the 
    pattern facet "  " of the type of element CRLF.

That makes no sense. The pattern facet clearly specifies "\r\n"

What am I doing wrong?

Received on Wednesday, 24 October 2012 12:55:38 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:02 UTC