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

restricting elements with anonymous types within named model groups

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Sat, 1 Feb 2003 11:45:57 -0500
To: <xmlschema-dev@w3.org>
Message-ID: <004f01c2ca11$65ace680$ca3bfea9@WALMSLEYPH>

Hi,

Is this schema snippet valid?  Note that the element within the group
has an anonymous type.

<xs:complexType name="base">
  <xs:group ref="group1"/>
  <xs:attribute name="attr1"/>
</xs:complexType>

<xs:complexType name="derived">
  <xs:complexContent>
    <xs:restriction base="base">
      <xs:group ref="group1"/>
      <xs:attribute name="attr1" use="required"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

<xs:group name="group1">
  <xs:sequence>
    <xs:element name="el1">
      <xs:simpleType>
        <xs:restriction base="xs:string"/>
      </xs:simpleType>
    </xs:element>
  </xs:sequence>
</xs:group>


If the sequence group were contained directly within the complex type,
it would not be valid since it is not possible to restrict an element
with an anonymous type.  Does the fact that it is in a named model group
affect this? I don't think it does - there are two separate particles
(the two group references), and one is not a valid restriction of the
other. 

I think the schema is invalid - but I just wanted to make sure.

Any thoughts?

Thanks,
Priscilla

-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
----------------------------------------------------- 
Received on Saturday, 1 February 2003 11:46:12 GMT

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