createTreeWalker method

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

 

Syntax

HRESULT retVal = object.createTreeWalker(pRootNode, ulWhatToShow, pFilter, fEntityReferenceExpansion, ppTreeWalker);

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 a pointer to a null value for no filter.

  • fEntityReferenceExpansion [in]
    Type: VARIANT_BOOL

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

  • ppTreeWalker [out, retval]
    Type: TreeWalker

    Returns a TreeWalker object.

Return value

Type: HRESULT

This method can return one of these values.

Return code Description
S_OK

The operation completed successfully.

NotSupportedError

pRootNode is NULL.

 

Standards information

Remarks

Use the IDocumentTraversal::createTreeWalker method when you want to navigate a representation of the document's hierarchical structure. If you would rather traverse a sequence of nodes without regard to document structure, use IDocumentTraversal::createNodeIterator.

When a custom NodeFilter function isn't needed, use a pointer to a null value rather than just a null value.

See also

IDocumentTraversal::createNodeIterator