1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::XML::TreeWalker</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.XML.html" class="namespace">Poco::XML</a></h1>
<h1 class="symbol">class TreeWalker</h1>
</div>
<div class="body">
<p>
<b>Library:</b> XML<br />
<b>Package:</b> DOM<br />
<b>Header:</b> Poco/DOM/TreeWalker.h</p>
<h2>Description</h2>
<div class="description">
<p><a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> objects are used to navigate a document tree or subtree using the view of the document defined by their whatToShow flags and filter (if any). <a href="Poco.Any.html" title="class Poco::Any">Any</a> function which performs navigation using a <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> will automatically support any view defined by a <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>. </p>
<p>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 <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> view may be children of different, widely separated nodes in the original view. For instance, consider a <a href="Poco.XML.NodeFilter.html" title="class Poco::XML::NodeFilter">NodeFilter</a> that skips all nodes except for <a href="Poco.XML.Text.html" title="class Poco::XML::Text">Text</a> 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. </p>
<p>A <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> can be directly instantiated using one of its constructors - the DocumentTraversal interface is not needed and therefore not implemented. Unlike most other DOM classes, <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> supports value semantics. </p>
<p>If the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>'s current node is removed from the document, the result of calling any of the movement methods is undefined. This behavior does not conform to the DOM Level 2 Traversal specification. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.XML.TreeWalker.html#18690" title="Poco::XML::TreeWalker::accept()">accept</a>, <a href="Poco.XML.TreeWalker.html#18679" title="Poco::XML::TreeWalker::currentNode()">currentNode</a>, <a href="Poco.XML.TreeWalker.html#18678" title="Poco::XML::TreeWalker::expandEntityReferences()">expandEntityReferences</a>, <a href="Poco.XML.TreeWalker.html#18677" title="Poco::XML::TreeWalker::filter()">filter</a>, <a href="Poco.XML.TreeWalker.html#18684" title="Poco::XML::TreeWalker::firstChild()">firstChild</a>, <a href="Poco.XML.TreeWalker.html#18680" title="Poco::XML::TreeWalker::getCurrentNode()">getCurrentNode</a>, <a href="Poco.XML.TreeWalker.html#18685" title="Poco::XML::TreeWalker::lastChild()">lastChild</a>, <a href="Poco.XML.TreeWalker.html#18692" title="Poco::XML::TreeWalker::next()">next</a>, <a href="Poco.XML.TreeWalker.html#18689" title="Poco::XML::TreeWalker::nextNode()">nextNode</a>, <a href="Poco.XML.TreeWalker.html#18687" title="Poco::XML::TreeWalker::nextSibling()">nextSibling</a>, <a href="Poco.XML.TreeWalker.html#18672" title="Poco::XML::TreeWalker::operator =()">operator =</a>, <a href="Poco.XML.TreeWalker.html#18683" title="Poco::XML::TreeWalker::parentNode()">parentNode</a>, <a href="Poco.XML.TreeWalker.html#18694" title="Poco::XML::TreeWalker::previous()">previous</a>, <a href="Poco.XML.TreeWalker.html#18688" title="Poco::XML::TreeWalker::previousNode()">previousNode</a>, <a href="Poco.XML.TreeWalker.html#18686" title="Poco::XML::TreeWalker::previousSibling()">previousSibling</a>, <a href="Poco.XML.TreeWalker.html#18675" title="Poco::XML::TreeWalker::root()">root</a>, <a href="Poco.XML.TreeWalker.html#18681" title="Poco::XML::TreeWalker::setCurrentNode()">setCurrentNode</a>, <a href="Poco.XML.TreeWalker.html#18676" title="Poco::XML::TreeWalker::whatToShow()">whatToShow</a></p>
<h2>Constructors</h2>
<h3><a name="18670">TreeWalker</a></h3>
<p class="decl"><a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>(<br /> const <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> & walker<br />);</p>
<div class="description">
<p>Creates a <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> by copying another <a href="Poco.XML.NodeIterator.html" title="class Poco::XML::NodeIterator">NodeIterator</a>. </p>
</div>
<h3><a name="18666">TreeWalker</a></h3>
<p class="decl"><a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>(<br /> <a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * root,<br /> unsigned long whatToShow,<br /> <a href="Poco.XML.NodeFilter.html" title="class Poco::XML::NodeFilter">NodeFilter</a> * pFilter = 0<br />);</p>
<div class="description">
<p>Creates a <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> over the subtree rooted at the specified node. </p>
</div>
<h2>Destructor</h2>
<h3><a name="18674">~TreeWalker</a></h3>
<p class="decl">~<a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="18679">currentNode</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * currentNode() const;</p>
<div class="description">
<p>The node at which the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> is currently positioned. Alterations to the DOM tree may cause the current node to no longer be accepted by the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>'s associated filter. currentNode may also be explicitly set to any node, whether or not it is within the subtree specified by the root node or would be accepted by the filter and whatToShow flags. Further traversal occurs relative to currentNode even if it is not part of the current view, by applying the filters in the requested direction; if no traversal is possible, currentNode is not changed. </p>
</div>
<h3><a name="18678">expandEntityReferences</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool expandEntityReferences() const;</p>
<div class="description">
<p>The value of this flag determines whether the children of entity reference nodes are visible to the iterator. If false, they and their descendants will be rejected. Note that this rejection takes precedence over whatToShow and the filter. Also note that this is currently the only situation where NodeIterators may reject a complete subtree rather than skipping individual nodes. </p>
<p>To produce a view of the document that has entity references expanded and does not expose the entity reference node itself, use the whatToShow flags to hide the entity reference node and set expandEntityReferences to true when creating the iterator. To produce a view of the document that has entity reference nodes but no entity expansion, use the whatToShow flags to show the entity reference node and set expandEntityReferences to false. </p>
<p>This implementation does not support entity reference expansion and thus always returns false. </p>
</div>
<h3><a name="18677">filter</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.NodeFilter.html" title="class Poco::XML::NodeFilter">NodeFilter</a> * filter() const;</p>
<div class="description">
<p>The <a href="Poco.XML.NodeFilter.html" title="class Poco::XML::NodeFilter">NodeFilter</a> used to screen nodes. </p>
</div>
<h3><a name="18684">firstChild</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * firstChild();</p>
<div class="description">
<p>Moves the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> to the first visible child of the current node, and returns the new node. If the current node has no visible children, returns null, and retains the current node. </p>
</div>
<h3><a name="18680">getCurrentNode</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * getCurrentNode() const;</p>
<div class="description">
<p>See <a href="Poco.XML.TreeWalker.html#18679" title="Poco::XML::TreeWalker::currentNode()">currentNode</a>(). </p>
</div>
<h3><a name="18685">lastChild</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * lastChild();</p>
<div class="description">
<p>Moves the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> to the last visible child of the current node, and returns the new node. If the current node has no visible children, returns null, and retains the current node. </p>
</div>
<h3><a name="18689">nextNode</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * nextNode();</p>
<div class="description">
<p>Moves the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> to the next visible node in document order relative to the current node, and returns the new node. If the current node has no next node, or if the search for nextNode attempts to step upward from the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>'s root node, returns null, and retains the current node. </p>
</div>
<h3><a name="18687">nextSibling</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * nextSibling();</p>
<div class="description">
<p>Moves the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> to the next sibling of the current node, and returns the new node. If the current node has no visible next sibling, returns null, and retains the current node. </p>
</div>
<h3><a name="18672">operator =</a></h3>
<p class="decl"><a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> & operator = (<br /> const <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> & walker<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="18683">parentNode</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * parentNode();</p>
<div class="description">
<p>Moves to and returns the closest visible ancestor node of the current node. If the search for parentNode attempts to step upward from the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>'s root node, or if it fails to find a visible ancestor node, this method retains the current position and returns null. </p>
</div>
<h3><a name="18688">previousNode</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * previousNode();</p>
<div class="description">
<p>Moves the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> to the previous visible node in document order relative to the current node, and returns the new node. If the current node has no previous node, or if the search for previousNode attempts to step upward from the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>'s root node, returns null, and retains the current node. </p>
</div>
<h3><a name="18686">previousSibling</a></h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * previousSibling();</p>
<div class="description">
<p>Moves the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a> to the previous sibling of the current node, and returns the new node. If the current node has no visible previous sibling, returns null, and retains the current node. </p>
</div>
<h3><a name="18675">root</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * root() const;</p>
<div class="description">
<p>The root node of the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>, as specified when it was created. </p>
</div>
<h3><a name="18681">setCurrentNode</a></h3>
<p class="decl">void setCurrentNode(<br /> <a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * pNode<br />);</p>
<div class="description">
<p>Sets the current node. </p>
</div>
<h3><a name="18676">whatToShow</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">unsigned long whatToShow() const;</p>
<div class="description">
<p>This attribute determines which node types are presented via the <a href="Poco.XML.TreeWalker.html" title="class Poco::XML::TreeWalker">TreeWalker</a>. The available set of constants is defined in the <a href="Poco.XML.NodeFilter.html" title="class Poco::XML::NodeFilter">NodeFilter</a> interface. Nodes not accepted by whatToShow will be skipped, but their children may still be considered. Note that this skip takes precedence over the filter, if any. </p>
</div>
<h3><a name="18690">accept</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int accept(<br /> <a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * pNode<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="18692">next</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * next(<br /> <a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * pNode<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="18694">previous</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * previous(<br /> <a href="Poco.XML.Node.html" title="class Poco::XML::Node">Node</a> * pNode<br />) const;</p>
<div class="description">
<p></p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|