W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

Circular types in XML Schemas

From: Yuri de Wit <yuri.dewit@metaserver.com>
Date: Tue, 30 Apr 2002 16:02:33 -0400 (EDT)
Message-ID: <D4DC61068C33D51186A700306E061976A42DFA@bianca.metaserver.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
The XML Schema specification constrains how groups may be used in circular
dependencies. My understanding is that the circularity constraint applies
only to model groups and nested items and not to top level types or
elements. 
For instance, consider the following XML Schema. Is it a valid XML Schema
with a recursive type reference? I can see problems if minOccurs=0 is not
specified, but is it a valid schema based on the XML Schema spec?

Is it valid?

<complexType name="error">
       <sequence>
           <element name="name" type="xsd:string"/>
           <element name="code" type="xsd:string" />
           <element name="message" type="xsd:string" />
           <element name="description" type="xsd:string" minOccurs="0"/>
           <element name="source" type="xsd:string" minOccurs="0"/>
           <element name="content" type="xsd:base64Binary" minOccurs="0"/>
           <element name="error" type="ms:error" minOccurs="0"/>
       </sequence>
</complexType>

Here is the part of the spec dealing with constraints on Model Groups 
----------------------------------------------------------------------------
-----
3.8.6 Constraints on Model Group Schema Components
All model groups (see Model Groups (3.8)) must satisfy the following
constraints.

Schema Component Constraint: Model Group Correct 

All of the following must be true:
1 The values of the properties of a model group must be as described in the
property tableau in The Model Group Schema Component (3.8.1), modulo the
impact of Missing Sub-components (5.3).
2 Circular groups are disallowed. That is, within the {particles} of a group
there must not be at any depth a particle whose {term} is the group itself.
-------------------------------------------------------
Received on Wednesday, 1 May 2002 04:56:51 UTC

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