W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

xs:integer restricted to be empty should be invalid (XSV and Xerces result)

From: Stanley Guan <stanley.guan@oracle.com>
Date: Mon, 17 Mar 2003 10:21:50 -0800
Message-ID: <080301c2ecb2$14e60d30$c5b42382@us.oracle.com>
To: <xmlschema-dev@w3.org>
Cc: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>

In the following schema document (i.e., mytest.xsd), base2 should not be
a valid restriction of base1 because base2's content is empty while empty
string is NOT valid with "xs:integer".

With my prelimary testing, both XSV and Xerces think mytest.xsd is valid.
For example, with the given instance document (i.e.,  mytest.xml).  Xerces
was happy.  But, if I changed subelement "alternate1" to "head", it failed
with:
   Element 'head' must have no element [children], and the value must be
valid.
because empty string is not valid with "xs:integer" type which is
contradictary
to the fact that Xerces thought mytest.xsd was valid.

Regards,

-Stanley


mytest.xsd
==========

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
    <xs:element name="head" type="base1"/>
    <xs:element name="alternate1" type="base2" substitutionGroup="head"
                block="substitution" />
    <xs:element name="root">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="head" minOccurs="1" maxOccurs="1"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="base1" >
        <xs:simpleContent>
            <xs:extension base="xs:integer">
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="base2">
        <xs:complexContent>
            <xs:restriction base="base1">
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

</xs:schema>

mytest.xml
========

<root>
 <alternate1></alternate1>
</root>
Received on Monday, 17 March 2003 13:24:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT