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

Re: Ordering of child nodes after parsing

  • From: Eric van der Vlist <vdv@d...>
  • To: Gareth Harper <Gareth.Harper@s...>
  • Date: Tue, 19 Dec 2000 14:25:39 +0100

xml parser child nodes order
> Gareth Harper wrote:
> 
> If, for example I have the following piece of xml
> 
> <parent>
>         <child attribute="blah1"/>
>         <child attribute="blah2"/>
>         <child attribute="blah3"/>
> </parent>
> 
> is it written (in the XML spec) anywhere that the parser must return
> those child nodes in the order that they have been given.  

In the XML 1.0 spec itself, I doubt you will find any statement about
this since this recommendation is mainly about syntax, but in the
infoset [1] it's clearly written that element children are "An ordered
list of child information items, in document order".

You should also find similar statements in the documentation or
specification of the parser you are using...

> I know it
> sounds right that it should, but I need to know if this is in the spec
> (this is for a boolean evaluation system I'm writing in XML / PERL and
> I need to know if for safety's sake I should put some ordering
> information in my children (variables), or if this is built into this
> spec)

I'd say that if you are using a XML parser, you can safely assume that
the elements will be returned in "document order"...

The only exception could be if you were using a higher level tool for a
vocabulary that explicitly states that the element order is not
significant (RDF is such a vocabulary).

Eric van der Vlist

[1] http://www.w3.org/TR/xml-infoset#infoitem.element
-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------

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.