SetNamedItem()

XmlAttributeCollection::SetNamedItem(SharedPtr<XmlNode>) method

Adds an XmlNode using its XmlNode::get_Name result.

SharedPtr<XmlNode> System::Xml::XmlAttributeCollection::SetNamedItem(SharedPtr<XmlNode> node) override

Arguments

ParameterTypeDescription
nodeSharedPtr<XmlNode>An attribute node to store in this collection. The node will later be accessible using the name of the node. If a node with that name is already present in the collection, it is replaced by the new one; otherwise, the node is appended to the end of the collection.

Return Value

If the node replaces an existing node with the same name, the old node is returned; otherwise, the added node is returned.

Exceptions

ExceptionDescription
ArgumentExceptionnode was created from a different XmlDocument than the one that created this collection. This XmlAttributeCollection is read-only.
InvalidOperationExceptionnode is an XmlAttribute that is already an attribute of another XmlElement object. To re-use attributes in other elements, you must clone the XmlAttribute objects you want to re-use.

See Also