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

Re: Create XML


how to write parsers
From: "Robert DiFalco" <rdifalco@t...>
>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.

Bob



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.