[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Defining recursive elements?

From: Michael Kay <mike@saxonica.com>
Date: Wed, 16 May 2007 21:51:50 +0100
To: "'Todd Moon'" <tmrfcm@gmail.com>, <xmlschema-dev@w3.org>
Message-ID: <01bc01c797fc$074c9280$6401a8c0@turtle>
RE: Defining recursive elements?

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 Wednesday, 16 May 2007 20:52:37 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.