3 ms·
> It's not something that an IBM committee would have come up with but it fits the needs of an application. Items can be order-dependent in XML. So the "id=1"
by dragontamer 6y ago
> It's not something that an IBM committee would have come up with but it fits the needs of an application.
Items can be order-dependent in XML. So the "id=1" thing is still superfluous. See xs:sequence. (In contrast: xs:all declares something to be order independent).
If you were doing XML for your own apps, I think xs:sequence items simplify parsing grossly.
Ex: if you have Address, maybe you always want "Street", then "Zip Code", then "State".
<Address>
<Street> 1234 Blah Street </Street>
<City> Springfield </City>
<State> Whatever </State>
<Zip> 55555 </Zip>
</Address>
By declaring that Street -> City -> State -> Zip must happen in that particular order, you can grossly simplify the parser's job when reading such data in. (Or writing it out).
--------
If there are multiple People at this address, you could (and probably should) just list them out in order.
<Address>
<Street> 1234 Blah Street </Street>
<City> Springfield </City>
<State> Whatever </State>
<Zip> 55555 </Zip>
<People>
<p> Marge </p>
<p> Homer </p>
<p> Lisa </p>
<p> Bart </p>
<p> Maggie </p>
</People>
</Address>