SetAttributeNode()

XmlElement::SetAttributeNode(SharedPtr<XmlAttribute>) method

Adds the specified XmlAttribute.

virtual SharedPtr<XmlAttribute> System::Xml::XmlElement::SetAttributeNode(SharedPtr<XmlAttribute> newAttr)

Arguments

ParameterTypeDescription
newAttrSharedPtr<XmlAttribute>The XmlAttribute node to add to the attribute collection for this element.

Return Value

If the attribute replaces an existing attribute with the same name, the old XmlAttribute is returned; otherwise, nullptr is returned.

Exceptions

ExceptionDescription
ArgumentExceptionThe newAttr was created from a different document than the one that created this node. Or this node is read-only.
InvalidOperationExceptionThe newAttr is already an attribute of another XmlElement object. You must explicitly clone XmlAttribute nodes to re-use them in other XmlElement objects.

XmlElement::SetAttributeNode(String, String) method

Adds the specified XmlAttribute.

virtual SharedPtr<XmlAttribute> System::Xml::XmlElement::SetAttributeNode(String localName, String namespaceURI)

Arguments

ParameterTypeDescription
localNameStringThe local name of the attribute.
namespaceURIStringThe namespace URI of the attribute.

Return Value

The XmlAttribute to add.

See Also