createNodeIterator method

Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.

 

Syntax

HRESULT retVal = object.createNodeIterator(pRootNode, ulWhatToShow, pFilter, fEntityReferenceExpansion, ppNodeIterator);

Parameters

  • pRootNode [in]
    Type: Node

    The root element or node to start traversing on.

  • ulWhatToShow [in]
    Type: long

    The type of nodes or elements to appear in the node list. For more information, see IDOMNodeIterator::whatToShow.

  • pFilter [in]
    Type: VARIANT

    A custom NodeFilter function to use. For more information, see IDOMNodeIterator::filter. Use NULL for no filter.

  • fEntityReferenceExpansion [in]
    Type: VARIANT_BOOL

    A flag that specifies whether entity reference nodes are expanded. For more information, see IDOMNodeIterator::expandEntityReferences.

  • ppNodeIterator [out, retval]
    Type: IDOMNodeIterator

    Returns a NodeIterator object.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Exceptions

Exception Condition
NotSupportedError

pRootNode is NULL. Versions earlier than Internet Explorer 10 will throw the exception as NOT_SUPPORTED_ERR.

 

Standards information

Remarks

Use the IDocumentTraversal::createNodeIterator method when you want to focus on node content because NodeIterator traverses a flat list of nodes in the document structure.