Share via


setNamedItem Method (Compact 2013)

3/26/2014

Adds the supplied node to the collection.

Syntax

var objXMLDOMNode = oIXMLDOMNamedNodeMap.setNamedItem(newItem);
HRESULT setNamedItem(  IXMLDOMNode* newItem,  IXMLDOMNode** nameItem);

Parameters

Script

  • newItem
    Object containing the attribute to be added to the collection.

C/C++

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

Return Value

Script

Object. Returns the attribute successfully added to the collection.

C/C++

  • 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 IXMLDOMNode, the supplied replaces the existing attribute. The attribute name appears in its IXMLDOMNode property.

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

This method applies to the following objects and interfaces:

IXMLDOMNode, and IXMLDOMNamedNodeMap.

Requirements

Header

msxml2.h,
msxml2.idl

Library

uuid.lib

See Also

Reference

XML DOM Methods