You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Ralph van Etten <ra...@et10.org> on 2008/05/22 11:16:12 UTC
DOM parser element ordering
Hi,
I have a question about the ordering of elements in the XercesDOMParser.
In what order are the elements retrieved with DOMNode::getChildNodes() ?
Are they in the same order as they appeared in the XML document or can
they also appear in some different order?
So, if I have the following XML
<rule id="first">...</rule>
<rule id="middle">...</rule>
<rule id="last">...</rule>
will the first element in the DOMNodeList returned by getChildNodes()
contain the rule with id first etc ?
I like to know for sure because I could not find any documentation on it.
Thanks,
Ralph.
Re: DOM parser element ordering
Posted by John Snelson <jo...@oracle.com>.
Hi Ralph,
Your assumption is correct - the child nodes in the DOMNodeList will be
in document order.
John
Ralph van Etten wrote:
> Hi,
>
> I have a question about the ordering of elements in the XercesDOMParser.
>
> In what order are the elements retrieved with DOMNode::getChildNodes() ?
> Are they in the same order as they appeared in the XML document or can
> they also appear in some different order?
>
> So, if I have the following XML
>
> <rule id="first">...</rule>
> <rule id="middle">...</rule>
> <rule id="last">...</rule>
>
> will the first element in the DOMNodeList returned by getChildNodes()
> contain the rule with id first etc ?
> I like to know for sure because I could not find any documentation on it.
>
> Thanks,
>
> Ralph.
--
John Snelson, Oracle Corporation http://snelson.org.uk/john
Berkeley DB XML: http://oracle.com/database/berkeley-db/xml
XQilla: http://xqilla.sourceforge.net