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

XML newbie question: processing order of XML elements

  • To: xml-dev@l...
  • Subject: XML newbie question: processing order of XML elements
  • From: "Ralf M." <ralfml@a...>
  • Date: Sat, 13 Dec 2003 15:22:57 -0800
  • Organization: Beatware Inc.
  • User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624

order of xml elements
Hi!
I have an XML newbie question regarding processing order of XML 
elements, I believe also called sequencing vs non-sequencing in XML.

Background: Until recently, I was told multiple times that element order 
should not matter in XML, whereas I always believed it should.
Well actually I always believed it should be meta semantic associated 
with the XML which was not expressed by the DTD nor the Schema (I still 
have a rather limited understanding of those, sorry). Reading the XML 
spec 1.0 again I find out that:
- Element content (http://www.w3.org/TR/REC-xml#sec-element-content) 
nodes contain other elements have an implicity ordering. The DTD 
described the grammar (choices, sequences, mixed).
- Mixed element (http://www.w3.org/TR/REC-xml#sec-mixed-content) nodes 
can contain both character data and child elements. In this case the DTD 
can constraint the type of the child elements but not their order nor 
their number.

I fail to see why the mixed elements could not constraint that, but 
that's not my question here.
I don't feel that the spec clearly precise what the user of the XML 
should do. Is it ok to process child nodes of a mixed element in 
arbitrary order? In real life, I do not think that would be wise (f.ex. 
<font> tags in an HTML <p>...).

So when I design my XML, should I expect all the target applications 
(especially the one I can't control) to process all the non-mixed 
elements in order, or should I provide some kind of mechanism to 
identify the order (I noticed RDF/XML has this rdf:seq in RSS 1.0, which 
looks redundant if element order is expected to be respected).
In my case I need to load some custom XML, process it (actually perform 
a simplistic diff on elements) and write it back. I'd like to know if 
generally speaking the ordering of elements should be retained or if the 
processing can reorder them as is most convenient. I'd like to avoid 
having to parse a DTD or a Schema if any.

Comments, bashing or references appreciated.
R/



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.