Click to return to the XML (Extensible Markup Language) home page    
IXMLDOMNamedNodeMap::rese...     IXMLDOMNamedNodeMap Inter...    
Web Workshop  |  XML (Extensible Markup Language)

IXMLDOMNamedNodeMap::setNamedItem Method


Adds the supplied node to the collection.

Visual Basic Syntax

Set objXMLDOMNode = oIXMLDOMNamedNodeMap.setNamedItem(newItem)

C/C++ Syntax

HRESULT setNamedItem(
    IXMLDOMNode *newItem,
    IXMLDOMNode **nameItem);

Parameters

newItem
[in] Attribute to be added to the collection.
nameItem
[out] Attribute successfully added to the collection. If null, no object is created.

C/C++ Return Values

S_OK
Value returned if successful.
E_INVALIDARG
Value returned if newItem is null.
E_FAIL
Value returned if an error occurs.

Remarks

If an attribute already exists with the name in the supplied IXMLDOMNode object, the supplied object replaces the existing attribute. The attribute name appears in its IXMLDOMNode property.

You cannot add an existing attribute to an element until you first remove it from its previous element. Also, you cannot add a namespace-qualified attribute when it uses the same prefix as another attribute with a different namespaceURI.

If the newItem node type is not NODE_ATTRIBUTE, setNamedItem returns an error. For example, it is not possible to modify entities and notations, which are read-only.



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.