Re: Recursive element definition

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 UTC