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 logic returns
it; otherwise, traversal looks for the next node and pretends that the
node that was rejected was not there.
The DOM does not provide any filters. NodeFilter is just an
interface that users can implement to provide their own filters.
NodeFilters do not need to know how to traverse from node
to node, nor do they need to know anything about the data structure that
is being traversed. This makes it very easy to write filters, since the
only thing they have to know how to do is evaluate a single node. One
filter may be used with a number of different kinds of traversals,
encouraging code reuse.
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
| Modifier and Type | Field and Description |
|---|---|
| public static final short | FILTER_ACCEPT
Accept the node. |
| public static final short | FILTER_REJECT
Reject the node. |
| public static final short | FILTER_SKIP
Skip this single node. |
| public static final int | SHOW_ALL
Show all |
| public static final int | SHOW_ATTRIBUTE
Show |
| public static final int | SHOW_CDATA_SECTION
Show |
| public static final int | SHOW_COMMENT
Show |
| public static final int | SHOW_DOCUMENT
Show |
| public static final int | SHOW_DOCUMENT_FRAGMENT
Show |
| public static final int | SHOW_DOCUMENT_TYPE
Show |
| public static final int | SHOW_ELEMENT
Show |
| public static final int | SHOW_ENTITY
Show |
| public static final int | SHOW_ENTITY_REFERENCE
Show |
| public static final int | SHOW_NOTATION
Show |
| public static final int | SHOW_PROCESSING_INSTRUCTION
Show |
| public static final int | SHOW_TEXT
Show |
| Modifier and Type | Method and Description |
|---|---|
| public short | Returns: A constant to determine whether the node is accepted, rejected, or skipped, as defined above.The node to check to see if it passes the filter or not. n)Test whether a specified node is visible in the logical view of a
|
| FILTER_ACCEPT | back to summary |
|---|---|
| public static final short FILTER_ACCEPT Accept the node. Navigation methods defined for
| |
| FILTER_REJECT | back to summary |
|---|---|
| public static final short FILTER_REJECT Reject the node. Navigation methods defined for
| |
| FILTER_SKIP | back to summary |
|---|---|
| public static final short FILTER_SKIP Skip this single node. Navigation methods defined for
| |
| SHOW_ALL | back to summary |
|---|---|
| public static final int SHOW_ALL Show all | |
| SHOW_ATTRIBUTE | back to summary |
|---|---|
| public static final int SHOW_ATTRIBUTE Show | |
| SHOW_CDATA_SECTION | back to summary |
|---|---|
| public static final int SHOW_CDATA_SECTION Show | |
| SHOW_COMMENT | back to summary |
|---|---|
| public static final int SHOW_COMMENT Show | |
| SHOW_DOCUMENT | back to summary |
|---|---|
| public static final int SHOW_DOCUMENT Show | |
| SHOW_DOCUMENT_FRAGMENT | back to summary |
|---|---|
| public static final int SHOW_DOCUMENT_FRAGMENT Show | |
| SHOW_DOCUMENT_TYPE | back to summary |
|---|---|
| public static final int SHOW_DOCUMENT_TYPE Show | |
| SHOW_ELEMENT | back to summary |
|---|---|
| public static final int SHOW_ELEMENT Show | |
| SHOW_ENTITY | back to summary |
|---|---|
| public static final int SHOW_ENTITY Show | |
| SHOW_ENTITY_REFERENCE | back to summary |
|---|---|
| public static final int SHOW_ENTITY_REFERENCE Show | |
| SHOW_NOTATION | back to summary |
|---|---|
| public static final int SHOW_NOTATION Show | |
| SHOW_PROCESSING_INSTRUCTION | back to summary |
|---|---|
| public static final int SHOW_PROCESSING_INSTRUCTION Show | |
| SHOW_TEXT | back to summary |
|---|---|
| public static final int SHOW_TEXT Show | |
| acceptNode | back to summary |
|---|---|
| public short acceptNode(Node n) Test whether a specified node is visible in the logical view of a
| |