Object: NodeFilter
The NodeFilter object is used to filter out nodes. If a NodeIterator or TreeWalker is given a NodeFilter, it applies the filter before it returns the next node. If the filter says to accept the node, the traversal object, either a NodeIterator or TreeWalker, returns it; otherwise, the traversal object looks for the next node and acts as if that the node that was rejected was not there.
NodeFilter constants
Constants returned by NodeFilter.acceptNode().
|
Constant |
Value type |
Description |
Support level |
Availability |
|---|---|---|---|---|
|
1 |
FILTER_ACCEPT |
Accepts the node. This node will be returned with the results of a NodeIterator or TreeWalker object. |
DOM 2 Traversal |
4.6 or later |
|
2 |
FILTER_REJECT |
Rejects the node. This node will not be returned with the results of a NodeIterator or TreeWalker object. For TreeWalker objects, the children of this node are also excluded. |
DOM 2 Traversal |
4.6 or later |
|
3 |
FILTER_SKIP |
Skips the node. This node will not be returned with the results of a NodeIterator or TreeWalker object. Children of this node are still considered. |
DOM 2 Traversal |
4.6 or later |
Constants for the NodeIterator.whatToShow and TreeWalker.whatToShow properties.
|
Constant |
Value type |
Description |
Support level |
Availability |
|---|---|---|---|---|
|
0xFFFFFFFF |
SHOW_ALL |
Shows all nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000001 |
SHOW_ELEMENT |
Shows Element nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000002 |
SHOW_ATTRIBUTE |
Shows Attr nodes. Because attributes are not the child of any other node, they never appear in the NodeIterator’s or TreeWalkers's logical view unless they are defined as the root of the object. If the respective node is not defined as the root, then SHOW_ATTRIBUTE has no meaning. |
DOM 2 Traversal |
4.6 or later |
|
0x00000004 |
SHOW_TEXT |
Shows Text nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000008 |
SHOW_CDATA_SECTION |
Shows CDATASection nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000010 |
SHOW_ENTITY_REFERENCE |
Shows EntityReference nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000020 |
SHOW _ENTITY |
Shows Entity nodes. Because entities are not the child of any other node, they never appear in the NodeIterator’s or TreeWalkers's logical view unless they are defined as the root of the object. If the respective node is not defined as the root, then SHOW_ENTITY has no meaning. |
DOM 2 Traversal |
4.6 or later |
|
0x00000040 |
SHOW_PROCESSING_INSTRUCTION |
Shows ProcessingInstruction nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000080 |
SHOW_COMMENT |
Shows Comment nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000100 |
SHOW_DOCUMENT |
Shows Document nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000200 |
SHOW_DOCUMENT_TYPE |
Shows DocumentType nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000400 |
SHOW_DOCUMENT_FRAGMENT |
Shows DocumentFragment nodes. |
DOM 2 Traversal |
4.6 or later |
|
0x00000800 |
SHOW_NOTATION |
Shows Notation nodes. Because notations are not the child of any other node, they never appear in the NodeIterator’s or TreeWalkers's logical view unless they are defined as the root of the object. If the respective node is not defined as the root, then SHOW_NOTATION has no meaning. |
DOM 2 Traversal |
4.6 or later |
NodeFilter methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
Tests whether a specified node is visible in the logical view of a NodeIterator or TreeWalker. Returns a NodeFilter constant. |
DOM 2 Traversal |
4.6 or later |