Javascript Reference
Categories: document

javascript document createNodeIterator( )

@March 15, 2008, 1:22 a.m.
createNodeIterator( ) Firefox/Netscape/NN n/a IE n/a Chrome/Safari/DOM 2

createNodeIterator(rootNode, whatToShow, filterFunction, entityRefExpansion)

Generates in memory an instance of a NodeIterator object. This method has the same set of parameters as the createTreeWalker( ) method, which is implemented in Netscape 7.

 
Parameters
rootNode

Reference to a node in the document tree that becomes the first node in the NodeIterator object's list of nodes.

whatToShow

Integer value corresponding to one of several built-in filters that allow nodes of a single type to be included in the NodeIterator object returned by the method. The NodeFilter object contains constants that should be used as plain-language substitutes for this value:

NodeFilter.SHOW_ALLNodeFilter.SHOW_ATTRIBUTE
NodeFilter.SHOW_CDATA_SECTIONNodeFilter.SHOW_COMMENT
NodeFilter.SHOW_DOCUMENTNodeFilter.SHOW_DOCUMENT_FRAGMENT
NodeFilter.SHOW_DOCUMENT_TYPENodeFilter.SHOW_ELEMENT
NodeFilter.SHOW_ENTITYNodeFilter.SHOW_ENTITY_REFERENCE
NodeFilter.SHOW_NOTATIONNodeFilter.SHOW_PROCESSING_INSTRUCTION
NodeFilter.SHOW_TEXT
filterFunction

Reference to a user function that can further filter nodes that are included in the NodeIterator object. The function has a single parameter (a reference to a node to test, invoked automatically by the NodeIterator object). The value returned by the function determines whether the node being tested is to be included in the list of nodes. Returned values are integers, but the NodeFilter object provides three constants you should use as plain-language substitutes:

NodeFilter.FILTER_ACCEPTNodeFilter.FILTER_REJECT
NodeFilter.FILTER_SKIP

Because a NodeIterator object does not maintain its list of nodes as a hierarchy, the values NodeFilter.FILTER_REJECT and NodeFilter.FILTER_SKIP pass over a node without any effect on child nodes. See the TreeWalker object for an example of this kind of function.

entityRefExpansion

Boolean value that controls whether the content of entity reference nodes (found predominantly in XML documents) should be treated as hierarchical nodes (true) or not (false).

 
Returned Value

NodeIterator object reference.


Powered by Linode.