|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] repeating element names in single XML vocabulary
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








