OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Create XML

[ Lists Home | Date Index | Thread Index ]

From: "Robert DiFalco" <rdifalco@tripwire.com>
>However, it seems harder to write parsers that process elements in a
>random ordering. So often, an arbitrary order is imposed (presumably) to
>make parsing easier.

When you use the word "parsers" people will think you mean XML parsers, but
I think you mean applications. I have seen applications written in top-down
style that process unordered elements by iterating over an n-element
in-memory DOM structure n times! But that's just poor style. In bottom-up
(event-driven) style, lack of order doesn't add complexity to the
application but order may require additional error-checking (if the parser
isn't validating).

>Being relatively new to XML, I am curious as to what the current thought
>is on this? Do most people impose an ordering or do they write their
>parser code to handle any order the elements may appear in.
>Of course, this isn't a big deal if my program is producing and
>consuming the XML. However, if I am consuming a document that a user
>produced, why should I force them to put FirstName, LastName, and
>Occupation into a particular order? A Person is still a Person if they
>appear as LastName, Occupation, and FirstName.

As HT pointed out, this is a religious (unresolvable) question.

It is amusing that you use FirstName and LastName as examples in this
context, as the order of names is ambiguous across cultures. ;-} I would
worry more about fixing that kind of ordering assumption, and otherwise just
do the simplest thing that works for you. There is a lot of "unnecessary"
order in some XML documents, but it's often more trouble to "fix" than the
result is worth.



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS