Packagedom.tr.traversal
Classpublic class NodeFilter
InheritanceNodeFilter Inheritance Object
Subclasses LSSerializerFilter

Introduced in: DOM 2 Core 

Filters are objects that know how 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 logic returns it; otherwise, traversal looks for the next node and pretends that the node that was rejected was not there.

See also

W3C - DOM Level 2 Traversal: NodeFilter


Public Methods
 MethodDefined By
  
DOM 2 TR acceptNode(n:Node):Number
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.
NodeFilter
Public Constants
 ConstantDefined By
  DOM 2 TR FILTER_ACCEPT : Number = 1
[static] Accept the node.
NodeFilter
  DOM 2 TR FILTER_REJECT : Number = 2
[static] Reject the node.
NodeFilter
  DOM 2 TR FILTER_SKIP : Number = 3
[static] Skip this single node.
NodeFilter
  DOM 2 TR SHOW_ALL : Number = -1
[static] Show all Nodes.
NodeFilter
  DOM 2 TR SHOW_ATTRIBUTE : Number = 2
[static] Show Attr nodes.
NodeFilter
  DOM 2 TR SHOW_CDATA_SECTION : Number = 8
[static] Show CDATASection nodes.
NodeFilter
  DOM 2 TR SHOW_COMMENT : Number = 128
[static] Show Comment nodes.
NodeFilter
  DOM 2 TR SHOW_DOCUMENT : Number = 256
[static] Show Document nodes.
NodeFilter
  DOM 2 TR SHOW_DOCUMENT_FRAGMENT : Number = 1024
[static] Show DocumentFragment nodes.
NodeFilter
  DOM 2 TR SHOW_DOCUMENT_TYPE : Number = 512
[static] Show DocumentType nodes.
NodeFilter
  DOM 2 TR SHOW_ELEMENT : Number = 1
[static] Show Element nodes.
NodeFilter
  DOM 2 TR SHOW_ENTITY : Number = 32
[static] Show Entity nodes.
NodeFilter
  DOM 2 TR SHOW_ENTITY_REFERENCE : Number = 16
[static] Show EntityReference nodes.
NodeFilter
  DOM 2 TR SHOW_NOTATION : Number = 2048
[static] Show Notation nodes.
NodeFilter
  DOM 2 TR SHOW_PROCESSING_INSTRUCTION : Number = 64
[static] Show ProcessingInstruction nodes.
NodeFilter
  DOM 2 TR SHOW_TEXT : Number = 4
[static] Show Text nodes.
NodeFilter
Method Detail
DOM 2 TR acceptNode()method
public function acceptNode(n:Node):Number

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 2 Core 

Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator. This function will be called by the implementation of TreeWalker and NodeIterator; it is not normally called directly from user code.

Parameters

n:Node — The node to check to see if it passes the filter or not.

Returns
Number — A constant to determine whether the node is accepted, rejected, or skipped.

See also

Constant Detail
DOM 2 TR FILTER_ACCEPTConstant
public static const FILTER_ACCEPT:Number = 1

Introduced in: DOM 2 Core 

Accept the node. Navigation methods defined for NodeIterator or TreeWalker will return this node.

DOM 2 TR FILTER_REJECTConstant 
public static const FILTER_REJECT:Number = 2

Introduced in: DOM 2 Core 

Reject the node. Navigation methods defined for NodeIterator or TreeWalker will not return this node. For TreeWalker, the children of this node will also be rejected. NodeIterators treat this as a synonym for FILTER_SKIP.

DOM 2 TR FILTER_SKIPConstant 
public static const FILTER_SKIP:Number = 3

Introduced in: DOM 2 Core 

Skip this single node. Navigation methods defined for NodeIterator or TreeWalker will not return this node. For both NodeIterator and TreeWalker, the children of this node will still be considered.

DOM 2 TR SHOW_ALLConstant 
public static const SHOW_ALL:Number = -1

Introduced in: DOM 2 Core 

Show all Nodes.

DOM 2 TR SHOW_ATTRIBUTEConstant 
public static const SHOW_ATTRIBUTE:Number = 2

Introduced in: DOM 2 Core 

Show Attr nodes. This is meaningful only when creating an iterator or tree-walker with an attribute node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree.

DOM 2 TR SHOW_CDATA_SECTIONConstant 
public static const SHOW_CDATA_SECTION:Number = 8

Introduced in: DOM 2 Core 

Show CDATASection nodes.

DOM 2 TR SHOW_COMMENTConstant 
public static const SHOW_COMMENT:Number = 128

Introduced in: DOM 2 Core 

Show Comment nodes.

DOM 2 TR SHOW_DOCUMENTConstant 
public static const SHOW_DOCUMENT:Number = 256

Introduced in: DOM 2 Core 

Show Document nodes.

DOM 2 TR SHOW_DOCUMENT_FRAGMENTConstant 
public static const SHOW_DOCUMENT_FRAGMENT:Number = 1024

Introduced in: DOM 2 Core 

Show DocumentFragment nodes.

DOM 2 TR SHOW_DOCUMENT_TYPEConstant 
public static const SHOW_DOCUMENT_TYPE:Number = 512

Introduced in: DOM 2 Core 

Show DocumentType nodes.

DOM 2 TR SHOW_ELEMENTConstant 
public static const SHOW_ELEMENT:Number = 1

Introduced in: DOM 2 Core 

Show Element nodes.

DOM 2 TR SHOW_ENTITYConstant 
public static const SHOW_ENTITY:Number = 32

Introduced in: DOM 2 Core 

Show Entity nodes. This is meaningful only when creating an iterator or tree-walker with an Entity node as its root; in this case, it means that the Entity node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree.

DOM 2 TR SHOW_ENTITY_REFERENCEConstant 
public static const SHOW_ENTITY_REFERENCE:Number = 16

Introduced in: DOM 2 Core 

Show EntityReference nodes.

DOM 2 TR SHOW_NOTATIONConstant 
public static const SHOW_NOTATION:Number = 2048

Introduced in: DOM 2 Core 

Show Notation nodes. This is meaningful only when creating an iterator or tree-walker with a Notation node as its root; in this case, it means that the Notation node will appear in the first position of the traversal. Since notations are not part of the document tree, they do not appear when traversing over the document tree.

DOM 2 TR SHOW_PROCESSING_INSTRUCTIONConstant 
public static const SHOW_PROCESSING_INSTRUCTION:Number = 64

Introduced in: DOM 2 Core 

Show ProcessingInstruction nodes.

DOM 2 TR SHOW_TEXTConstant 
public static const SHOW_TEXT:Number = 4

Introduced in: DOM 2 Core 

Show Text nodes.