- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 1 May 2002 10:12:24 +0100
- To: Yuri de Wit <yuri.dewit@metaserver.com>
- CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Hi Yuri,
> 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.
Circularity constraints apply to types in that a type cannot be
derived from itself (clause 3 of
http://www.w3.org/TR/xmlschema-1/#ct-props-correct), but you're right
that it's fine for a complex type to contain an element declaration
whose type is that complex type. That isn't circular.
Similarly, it isn't circular to have:
<xs:group name="error">
<xs:sequence>
...
<xs:element name="error">
<xs:complexType>
<xs:group ref="ms:error" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>
The circularity constraint on model groups states that the particles
of the group, at any depth, cannot include the group itself. In the
case above, the particles of the ms:error group are a sequence,
various other things, and an error element. The particles that are
part of the content type of the error element aren't particles of the
group -- as far as a validator is concerned, the element declaration
is a black box.
> 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>
Yes, that's fine.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 1 May 2002 05:12:26 UTC