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

Re: Defining recursive elements?

From: Pete Cordell <petexmldev@tech-know-ware.com>
Date: Thu, 17 May 2007 16:57:46 +0100
Message-ID: <001701c7989c$277c34c0$4200a8c0@Codalogic>
To: "Andrew Welch" <andrew.j.welch@gmail.com>, "Michael Kay" <mike@saxonica.com>
Cc: "Todd Moon" <tmrfcm@gmail.com>, <xmlschema-dev@w3.org>
Re: Defining recursive elements?

----- Original Message From: "Andrew Welch" <...>
To: "Michael Kay" <...>
Cc: "Todd Moon" <...>; <...>


>
> On 5/17/07, Michael Kay <mike@saxonica.com> wrote:
>> > Well it's a matter of taste, but if you use the venetian
>> > blind style of schema then you wouldn't use element ref=""
>> > much, but @type instead, eg:
>> >
>> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> >
>> >   <xs:element name="part" type="part"/>
>> >
>> >   <xs:complexType name="part">
>> >     <xs:sequence>
>> >       <xs:element name="part" type="part" minOccurs="0"
>> > maxOccurs="unbounded"/>
>> >     </xs:sequence>
>> >     <xs:attribute name="serial" type="xs:string"/>
>> >   </xs:complexType>
>> >
>>
>> I'm not sure it's just a matter of taste. It feels wrong to me to have 
>> two
>> element declarations for element part, one global and one local, when all
>> the part elements are the same. It gives the same answers as far as
>> validation of instances is concerned, but it seems a messier component
>> model, which could give you a messier translation into classes when you 
>> do
>> data binding, for example (I don't know if that's actually the case).


It may also depend on whether the global element 'part' is the only element 
to have type 'part'.  And also depends on whether you might want to add 
another element of type 'part' later (although it's not impossible to tweak 
that when the need arises!).

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML Schema to C++ data binding visit
 http://www.tech-know-ware.com/lmx/
 http://www.codalogic.com/lmx/
============================================= 
Received on Thursday, 17 May 2007 15:58:19 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.