CreateAttribute()

XmlDocument::CreateAttribute(const String&) method

Creates an XmlAttribute with the specified name.

SharedPtr<XmlAttribute> System::Xml::XmlDocument::CreateAttribute(const String &name)

Arguments

ParameterTypeDescription
nameconst String&The qualified name of the attribute. If the name contains a colon, the XmlNode::get_Prefix value reflects the part of the name preceding the first colon and the XmlDocument::get_LocalName value reflects the part of the name following the first colon. The XmlNode::get_NamespaceURI remains empty unless the prefix is a recognized built-in prefix such as xmlns. In this case get_NamespaceURI has a value of http://www.w3.org/2000/xmlns/.

Return Value

The new XmlAttribute.

XmlDocument::CreateAttribute(const String&, const String&) method

Creates an XmlAttribute with the specified qualified name and XmlNode::get_NamespaceURI.

SharedPtr<XmlAttribute> System::Xml::XmlDocument::CreateAttribute(const String &qualifiedName, const String &namespaceURI)

Arguments

ParameterTypeDescription
qualifiedNameconst String&The qualified name of the attribute. If the name contains a colon then the XmlNode::get_Prefix value will reflect the part of the name preceding the colon and the XmlDocument::get_LocalName value will reflect the part of the name after the colon.
namespaceURIconst String&The namespaceURI of the attribute. If the qualified name includes a prefix of xmlns, then this parameter must be http://www.w3.org/2000/xmlns/.

Return Value

The new XmlAttribute.

XmlDocument::CreateAttribute(const String&, const String&, const String&) method

Creates an XmlAttribute with the specified XmlNode::get_Prefix, XmlDocument::get_LocalName, and XmlNode::get_NamespaceURI.

virtual SharedPtr<XmlAttribute> System::Xml::XmlDocument::CreateAttribute(const String &prefix, const String &localName, const String &namespaceURI)

Arguments

ParameterTypeDescription
prefixconst String&The prefix of the attribute (if any). String::Empty and nullptr are equivalent.
localNameconst String&The local name of the attribute.
namespaceURIconst String&The namespace URI of the attribute (if any). String::Empty and nullptr are equivalent. If prefix is xmlns, then this parameter must be http://www.w3.org/2000/xmlns/; otherwise an exception is thrown.

Return Value

The new XmlAttribute.

See Also