42 package org.w3c.dom.traversal;
43
44 import org.w3c.dom.Node;
45
46 /**
47 * Filters are objects that know how to "filter out" nodes. If a
48 * <code>NodeIterator</code> or <code>TreeWalker</code> is given a
49 * <code>NodeFilter</code>, it applies the filter before it returns the next
50 * node. If the filter says to accept the node, the traversal logic returns
51 * it; otherwise, traversal looks for the next node and pretends that the
52 * node that was rejected was not there.
53 * <p>The DOM does not provide any filters. <code>NodeFilter</code> is just an
54 * interface that users can implement to provide their own filters.
55 * <p><code>NodeFilters</code> do not need to know how to traverse from node
56 * to node, nor do they need to know anything about the data structure that
57 * is being traversed. This makes it very easy to write filters, since the
58 * only thing they have to know how to do is evaluate a single node. One
59 * filter may be used with a number of different kinds of traversals,
60 * encouraging code reuse.
61 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
62 * @since 1.9, DOM Level 2
63 */
64 public interface NodeFilter {
65 // Constants returned by acceptNode
66 /**
67 * Accept the node. Navigation methods defined for
68 * <code>NodeIterator</code> or <code>TreeWalker</code> will return this
69 * node.
70 */
71 public static final short FILTER_ACCEPT = 1;
72 /**
73 * Reject the node. Navigation methods defined for
74 * <code>NodeIterator</code> or <code>TreeWalker</code> will not return
75 * this node. For <code>TreeWalker</code>, the children of this node
76 * will also be rejected. <code>NodeIterators</code> treat this as a
77 * synonym for <code>FILTER_SKIP</code>.
78 */
79 public static final short FILTER_REJECT = 2;
80 /**
81 * Skip this single node. Navigation methods defined for
82 * <code>NodeIterator</code> or <code>TreeWalker</code> will not return
|
42 package org.w3c.dom.traversal;
43
44 import org.w3c.dom.Node;
45
46 /**
47 * Filters are objects that know how to "filter out" nodes. If a
48 * <code>NodeIterator</code> or <code>TreeWalker</code> is given a
49 * <code>NodeFilter</code>, it applies the filter before it returns the next
50 * node. If the filter says to accept the node, the traversal logic returns
51 * it; otherwise, traversal looks for the next node and pretends that the
52 * node that was rejected was not there.
53 * <p>The DOM does not provide any filters. <code>NodeFilter</code> is just an
54 * interface that users can implement to provide their own filters.
55 * <p><code>NodeFilters</code> do not need to know how to traverse from node
56 * to node, nor do they need to know anything about the data structure that
57 * is being traversed. This makes it very easy to write filters, since the
58 * only thing they have to know how to do is evaluate a single node. One
59 * filter may be used with a number of different kinds of traversals,
60 * encouraging code reuse.
61 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
62 * @since 9, DOM Level 2
63 */
64 public interface NodeFilter {
65 // Constants returned by acceptNode
66 /**
67 * Accept the node. Navigation methods defined for
68 * <code>NodeIterator</code> or <code>TreeWalker</code> will return this
69 * node.
70 */
71 public static final short FILTER_ACCEPT = 1;
72 /**
73 * Reject the node. Navigation methods defined for
74 * <code>NodeIterator</code> or <code>TreeWalker</code> will not return
75 * this node. For <code>TreeWalker</code>, the children of this node
76 * will also be rejected. <code>NodeIterators</code> treat this as a
77 * synonym for <code>FILTER_SKIP</code>.
78 */
79 public static final short FILTER_REJECT = 2;
80 /**
81 * Skip this single node. Navigation methods defined for
82 * <code>NodeIterator</code> or <code>TreeWalker</code> will not return
|