System::Xml::XmlDocument::CreateAttribute 方法

XmlDocument::CreateAttribute(const String&) method

使用指定的名称创建一个 XmlAttribute

SharedPtr<XmlAttribute> System::Xml::XmlDocument::CreateAttribute(const String &name)
参数类型描述
nameconst String&属性的限定名称。如果名称包含冒号,XmlNode::get_Prefix 的值表示冒号前的部分,而 XmlDocument::get_LocalName 的值表示冒号后的部分。XmlNode::get_NamespaceURI 保持为空,除非前缀是已识别的内置前缀,如 xmlns。在这种情况下,get_NamespaceURI 的值为 http://www.w3.org/2000/xmlns/

ReturnValue

新的 XmlAttribute

另见

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

使用指定的 XmlNode::get_PrefixXmlDocument::get_LocalNameXmlNode::get_NamespaceURI 创建一个 XmlAttribute

virtual SharedPtr<XmlAttribute> System::Xml::XmlDocument::CreateAttribute(const String &prefix, const String &localName, const String &namespaceURI)
参数类型描述
prefixconst String&属性的前缀(如果有)。String::Emptynullptr 等价。
localNameconst String&属性的本地名称。
namespaceURIconst String&属性的命名空间 URI(如果有)。String::Emptynullptr 等价。如果 prefixxmlns,则此参数必须是 http://www.w3.org/2000/xmlns/;,否则将抛出异常。

ReturnValue

新的 XmlAttribute

另见

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

使用指定的限定名称和 XmlNode::get_NamespaceURI 创建一个 XmlAttribute

SharedPtr<XmlAttribute> System::Xml::XmlDocument::CreateAttribute(const String &qualifiedName, const String &namespaceURI)
参数类型描述
qualifiedNameconst String&属性的限定名称。如果名称包含冒号,则 XmlNode::get_Prefix 的值将显示冒号前的部分,而 XmlDocument::get_LocalName 的值将显示冒号后的部分。
namespaceURIconst String&属性的 namespaceURI。如果限定名称包含前缀 xmlns,则此参数必须是 http://www.w3.org/2000/xmlns/

ReturnValue

新的 XmlAttribute

另见