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

repeating element names in single XML vocabulary

  • To: xml-dev@l...
  • Subject: repeating element names in single XML vocabulary
  • From: Lyndon J B Nixon <nixon@f...>
  • Date: Wed, 27 Feb 2002 12:55:03 +0100

xml repeating elements
hi all,

although it seems intuitively wrong to use the same name for two different 
elements in the same XML vocabulary, I have been struggling with finding 
convincing arguments for avoiding this practice. Take this example:

<MyXML>
         <Part1>
                 .....
         </Part1>
         <Part2>
                 <PartsInventory>
                         <Part1>....</Part1>
                         <Part2>....</Part2>
                 </PartsInventory>
         </Part2>
</MyXML>

In the schema it is possible to differentiate the elements so that a parser 
can apply the correct schema definition for both (see code below).
As can as I can ascertain, one can still make use of all the various XML 
standards (DOM, XSLT, XPath, ..) provided
(1)  the parser is instructed to begin parsing within the first Part2 
element (and hence unambiguously deals with the Part1 and Part2
elements it encounters)
(2)  operations on a Part1 or Part2 element is qualified (e.g. only Part1 
elements which are children of PartsInventory, all Part2 elements
  which are not children of MyXML)

So, is the worst result of repeating element names that someone writing 
code to operate with this XML vocabulary may need to add
a little bit more of code? Or have I overlooked a "killer" argument against?

  thanks in advance

  lyndon

<element name="MyXML">
       <complexType>
          <sequence>
             <element name="Part1" minOccurs="0">
                ...
             </element>
            <element name="Part2" minOccurs="0">
                <complexType>
                   <choice minOccurs="0" maxOccurs="unbounded">
                      <element ref="PartsInventory"/>
                   </choice>
                </complexType>
             </element>
          </sequence>
       </complexType>
    </element>

     <element name="PartsInventory">
       <complexType>
          <all>
             <element ref="Part1" minOccurs="0"/>
             <element ref="Part2" minOccurs="0"/>
          </all>
       </complexType>
    </element>

    <element name="Part1">
                ...
    </element>

    <element name="Part2">
                ...
    </element>


Lyndon J B Nixon ... MAGIC Centre, FHG FOKUS ... Berlin, Germany
"what is now proved was once only imagined" - william blake
PhD Student, Integration of Internet with MPEG-4 & MPEG-7


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.