The NodeIterator utility interface extracts a subset of the nodes in a DOM document and presents them as a list arranged in document order. In other words, the nodes appear in the order in which you would find them in a depth-first, preorder traversal of the tree. That is,
The document node comes first.
Parents come before their children; ancestors come before their descendants.
Sibling nodes appear in the same order as their start-tags in the text representation of the document.
This is pretty much the order you would expect just by reading an XML document from beginning to end. As soon as you see the first character of text from a node, that node is counted.
You can iterate through this list without concerning yourself with the tree ...