[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
emptiable content in particle inheritance

Hej,

there are the two schemas

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

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

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

Ciao,
Tobias
Received on Monday, 2 February 2009 10:34:20 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.