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

Re: Defining recursive elements?

From: Todd Moon <tmrfcm@gmail.com>
Date: Thu, 17 May 2007 09:51:19 -0400
Message-ID: <2dc6e4c80705170651x64e67041j7bae0d5442584525@mail.gmail.com>
To: xmlschema-dev@w3.org

Thank you Michael and Shlomo. I didn't know about the ref attribute.
You saved me a lot of time reading documentation. :)

- Todd

On 5/16/07, Michael Kay <mike@saxonica.com> wrote:
> No problem. In essence it's:
>
> <xs:element name="part">
>  <xs:complexType>
>   <xs:sequence>
>    <xs:element ref="part" minOccurs="0" maxOccurs="unbounded"/>
>   </xs:sequence>
>  </xs:complexType>
> </xs:element>
>
> (and add the attribute)
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: xmlschema-dev-request@w3.org
> > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Todd Moon
> > Sent: 16 May 2007 18:55
> > To: xmlschema-dev@w3.org
> > Subject: Defining recursive elements?
> >
> >
> > I'm not sure if the subject is accurate, but I'm trying to
> > author an XSD that allows a certain complex type to be nested
> > within itself to an arbitrary depth.
> >
> > A simple example would look like this:
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <part serial="00000001234">
> >   <part serial="00000001234">
> >     <part serial="00000001234">
> >     </part>
> >     <part serial="00000001234">
> >     </part>
> >     <part serial="00000001234">
> >       <part serial="00000001234">
> >       </part>
> >       <part serial="00000001234">
> >         <part serial="00000001234">
> >         </part>
> >       </part>
> >     </part>
> >   </part>
> >   <part serial="00000001234">
> >   </part>
> > </part>
> >
> > Any "part" can contain any number of other parts.
> >
> > Is it possible to validate this structure without putting an
> > arbitrary limit on the maximum depth?
> >
> >
>
>
Received on Thursday, 17 May 2007 13:51:27 GMT

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