- From: Yuri de Wit <yuri.dewit@metaserver.com>
- Date: Wed, 1 May 2002 11:32:59 -0400 (EDT)
- To: "'Jeni Tennison'" <jeni@jenitennison.com>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Jeni,
What does the XML Schema specification says about infinite recursive types,
i.e. the ones that do not have a minOccurs="0" as a loophole?
Like the following error schema:
<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"/>
</sequence>
</complexType>
Thanks,
Yuri
> -----Original Message-----
> From: Jeni Tennison [mailto:jeni@jenitennison.com]
> Sent: Wednesday, May 01, 2002 05:12
> To: Yuri de Wit
> Cc: 'xmlschema-dev@w3.org'
> Subject: Re: Circular types in XML Schemas
>
>
> 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 Friday, 3 May 2002 05:18:23 UTC