Microsoft XML 2.5 SDK


 

IXMLDOMNode::get_parentNode Method

[This is preliminary documentation and subject to change.]

Contains the parent node (for nodes that can have parents).

Visual Basic Syntax

Set objXMLDOMNode = oXMLDOMNode.parentNode

C/C++ Syntax

HRESULT get_parentNode(

    IXMLDOMNode **parent);

Parameters

parent

[out]
Parent of the given node instance. All nodes, except Document, DocumentFragment, and Attribute nodes, can have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, the parent is null.

C/C++ Return Values

S_OK

Value returned if successful.

E_INVALIDARG

Value returned if parent is null.

Remarks

This value depends on the value of the nodeType property.

NODE_ATTRIBUTE, NODE_DOCUMENT, NODE_DOCUMENT_FRAGMENT Null; they do not have parents.
NODE_CDATA_SECTION The element or entity reference containing the CDATA section.
NODE_COMMENT The element, entity reference, document type, or document containing the comment.
NODE_DOCUMENT_TYPE The document node.
NODE_ELEMENT The parent node of the element. If the element is the root node in the tree, the parent is the document node. If the node is the document node, parentNode is null.
NODE_ENTITY The document type node.
NODE_ENTITY_REFERENCE The element, attribute, or entity reference containing the entity reference.
NODE_NOTATION The document type node.
NODE_PROCESSING_INSTRUCTION The document, element, document type, or entity reference containing the processing instruction.
NODE_TEXT The parent element, attribute, or entity reference.