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

Re: Defining recursive elements?

From: Boris Kolpackov <boris@codesynthesis.com>
Date: Thu, 17 May 2007 22:22:17 +0200
To: xmlschema-dev@w3.org
Cc: "'Andrew Welch'" <andrew.j.welch@gmail.com>, Michael Kay <mike@saxonica.com>, "'Todd Moon'" <tmrfcm@gmail.com>
Message-ID: <20070517202217.GE10357@karelia>
Re: Defining recursive elements?

Hi,

Andrew Welch <andrew.j.welch@gmail.com> writes:

> 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>
>
> </xs:schema>

Note that this change will result in a different schema if there
was a target namespace involved. In the original example, both
elements are qualified while in this schema the global one would
be qualified while the local one wouldn't.


Michael Kay <mike@saxonica.com> writes:

> ... 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).

I don't think this design would cause any problems in data binding since
most tools would translate types to classes and there is only one type
involved. The local part element would normally end up being translated
to a member function in that class while the global one could be mapped
to something that can parse a document (e.g., a global function).

hth,
-boris


--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
Received on Thursday, 17 May 2007 20:25:40 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.