W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2009

emptiable content in particle inheritance

From: Tobias Koenig <tobias.koenig@trolltech.com>
Date: Mon, 2 Feb 2009 11:33:35 +0100
To: xmlschema-dev@w3.org
Message-Id: <200902021133.35789.tobias.koenig@trolltech.com>


there are the two schemas

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="doc" type="foo"/>
    <xsd:complexType name="foo">
        <xsd:restriction base="bar">
            <xsd:element name="e1" minOccurs="0" maxOccurs="0"/>
            <xsd:element name="e2"/>
    <xsd:complexType name="bar">
        <xsd:element name="e1"/>
        <xsd:element name="e2"/>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:complexType name="base">
    <xs:element name="e1" type="xs:string" />
 <xs:complexType name="derived">
        <xs:restriction base="base">
            <xs:choice minOccurs="0">
                <xs:element name="e1" type="xs:string" />

In both cases a complex type with emptiable particle derives by restriction 
from a complex type with non-emptiable particle. However the first schema
is valid according to xml schema test suite (and saxon validator) but the 
second is not. So what is the real issue in the second schema? That a choice
particle is inherited from an sequence particle?

Thanks in advance

Received on Monday, 2 February 2009 10:34:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:15 UTC