org.metasyntactic.xml.dom.traversal
Class TraversalFactory
java.lang.Object
|
+--org.metasyntactic.xml.dom.traversal.TraversalFactory
- public class TraversalFactory
- extends java.lang.Object
TraversalFactory contains methods that create iterators and tree-walkers to
traverse a node and its children in document order (depth first, pre-order
traversal, which is equivalent to the order in which the start tags occur in
the text representation of the document).
Method Summary |
static org.w3c.dom.traversal.NodeIterator |
newNodeIterator(org.w3c.dom.Node root,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter,
boolean entityReferenceExpansion)
NodeIterators are used to step through a set of nodes, e.g. |
static org.w3c.dom.traversal.TreeWalker |
newTreeWalker(org.w3c.dom.Node root,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter,
boolean entityReferenceExpansion)
TreeWalker objects are used to navigate a document tree or subtree using
the view of the document defined by its whatToShow flags and any filters
that are defined for the TreeWalker . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TraversalFactory
public TraversalFactory()
newNodeIterator
public static org.w3c.dom.traversal.NodeIterator newNodeIterator(org.w3c.dom.Node root,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter,
boolean entityReferenceExpansion)
- NodeIterators are used to step through a set of nodes, e.g. the set of
nodes in a NodeList, the document subtree governed by a particular node,
the results of a query, or any other set of nodes. The set of nodes to be
iterated is determined by the implementation of the NodeIterator. DOM
Level 2 specifies a single NodeIterator implementation for document-order
traversal of a document subtree. Instances of these iterators are created
by calling DocumentTraversal.createNodeIterator().
newTreeWalker
public static org.w3c.dom.traversal.TreeWalker newTreeWalker(org.w3c.dom.Node root,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter,
boolean entityReferenceExpansion)
throws org.w3c.dom.DOMException
- TreeWalker objects are used to navigate a document tree or subtree using
the view of the document defined by its whatToShow flags and any filters
that are defined for the TreeWalker . Any function which performs
navigation using a TreeWalker will automatically support any view defined
by a TreeWalker .
Omitting nodes from the logical view of a subtree can result in a
structure that is substantially different from the same subtree in the
complete, unfiltered document. Nodes that are siblings in the TreeWalker
view may be children of different, widely separated nodes in the original
view. For instance, consider a Filter that skips all nodes except for
Text nodes and the root node of a document. In the logical view that
results, all text nodes will be siblings and appear as direct children of
the root node, no matter how deeply nested the structure of the original
document.
org.w3c.dom.DOMException