W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: Recursive element definition

From: <Mike_Leditschke@nemmco.com.au>
Date: Tue, 12 Jun 2001 10:51:28 +1000
To: "Jeff Rafter" <jeffrafter@definedweb.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OFF21120DA.DFFFB1DA-ON4A256A69.00042C4A@nemmco.com.au>

Jeff, given that the schema shown does not provide minOccurs/maxOccurs
attributes, the defaults
for theses are 1 and 1. So because of the defaults, the minOccurs for
CATEGORY is 1. Hence,
by your logic, isn't the schema infinitely recursive?

I think the element referring to CATEGORY needs a minOccurs attribute?

Regards
Michael



                                                                                                                                             
                    "Jeff Rafter"                                                                                                            
                    <jeffrafter@define        To:     <xmlschema-dev@w3.org>                                                                 
                    dweb.com>                 cc:                                                                                            
                    Sent by:                  Subject:     Re: Recursive element definition                                                  
                    xmlschema-dev-requ                                                                                                       
                    est@w3.org                                                                                                               
                                                                                                                                             
                                                                                                                                             
                    12/06/2001 02:25                                                                                                         
                    AM                                                                                                                       
                                                                                                                                             
                                                                                                                                             



Stefan,

This is okay and happens quite often.  The thing you want to make sure of
is
that the particle is emptiable-- meaning you don't want to force the
definition to be infinite (which you haven't done).  For example if you set
the minOccurs of CATEGORY to 1 this structure would go on recursively
indefinitely.

http://www.w3.org/TR/xmlschema-1/#cos-group-emptiable

Good luck,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting

----- Original Message -----
From: "Stefan Panek" <spanek@siebel.com>
To: <xmlschema-dev@w3.org>
Sent: Monday, May 28, 2001 1:41 AM
Subject: Recursive element definition


> Hi there,
> I trying to solve the following problem:
> I want define a elemet CATEGORY.
> As a category can contain sub-categories the element itself is used again
as
> "child"-element in the "parent"-element.
> I tried the following Schema-definition. But is looks somehow strange to
me:
> <xsd:element name="CATEGORY">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="CATEGORY">
> <xsd:element ref="PART"/>
> </xsd:sequence>
> <xsd:attribute name="NAME" type="xsd:string" use="required"/>
> <xsd:attribute name="SEQ" type="xsd:integer" use="required"/>
> </xsd:complexType>
> </xsd:element>
>
> Can anyone verify that or has a tip for me ?
> Thx.
> Stefan
>
>
Received on Monday, 11 June 2001 20:53:22 GMT

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