[
Lists Home |
Date Index |
Thread Index
]
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
|