Click to return to the XML (Extensible Markup Language) home page    
IXMLDOMDocument::document...     IXMLDOMDocument::implemen...     IXMLDOMDocument Interface    
Web Workshop  |  XML (Extensible Markup Language)

IXMLDOMDocument::getElementsByTagName Method


Returns a collection of elements that have the specified name.

Visual Basic Syntax

Set objXMLDOMNodeList = oXMLDOMDocument.XMLDOMDocument(tagName)

C/C++ Syntax

HRESULT getElementsByTagName(
    BSTR tagname,
    IXMLDOMNodeList **resultList);

Parameters

tagname
[in] Element name to find. The tagname "*" returns all elements in the document.
resultList
[out] Address of a collection of elements that match the specified name.

C/C++ Return Value

Returns S_OK if successful, or an error code otherwise.

Remarks

The elements in the collection are returned in the order in which they would be encountered in a preorder traversal of the document tree. In a preorder traversal, the parent root node is visited first, then each child node from left to right is traversed.

The returned IXMLDOMNodeList object is live and immediately reflects changes to the nodes that appear in the list.

More complex searches can be performed using the selectNodes method, which may also be faster in some cases.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.