[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XML newbie question: processing 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|