XmlElement.RemoveAttributeNode メソッド

定義

XmlAttributeを削除します。

オーバーロード

名前 説明
RemoveAttributeNode(XmlAttribute)

指定した XmlAttributeを削除します。

RemoveAttributeNode(String, String)

ローカル名と名前空間 URI で指定された XmlAttribute を削除します。 (削除された属性に既定値がある場合は、すぐに置き換えられます)。

RemoveAttributeNode(XmlAttribute)

指定した XmlAttributeを削除します。

public:
 virtual System::Xml::XmlAttribute ^ RemoveAttributeNode(System::Xml::XmlAttribute ^ oldAttr);
public virtual System.Xml.XmlAttribute RemoveAttributeNode(System.Xml.XmlAttribute oldAttr);
abstract member RemoveAttributeNode : System.Xml.XmlAttribute -> System.Xml.XmlAttribute
override this.RemoveAttributeNode : System.Xml.XmlAttribute -> System.Xml.XmlAttribute
Public Overridable Function RemoveAttributeNode (oldAttr As XmlAttribute) As XmlAttribute

パラメーター

oldAttr
XmlAttribute

削除する XmlAttribute ノード。 削除された属性に既定値がある場合は、すぐに置き換えられます。

返品

oldAttrXmlElementの属性ノードでない場合は、削除されたXmlAttributeまたはnull

例外

このノードは読み取り専用です。

適用対象

RemoveAttributeNode(String, String)

ローカル名と名前空間 URI で指定された XmlAttribute を削除します。 (削除された属性に既定値がある場合は、すぐに置き換えられます)。

public:
 virtual System::Xml::XmlAttribute ^ RemoveAttributeNode(System::String ^ localName, System::String ^ namespaceURI);
public virtual System.Xml.XmlAttribute RemoveAttributeNode(string localName, string namespaceURI);
abstract member RemoveAttributeNode : string * string -> System.Xml.XmlAttribute
override this.RemoveAttributeNode : string * string -> System.Xml.XmlAttribute
Public Overridable Function RemoveAttributeNode (localName As String, namespaceURI As String) As XmlAttribute

パラメーター

localName
String

属性のローカル名。

namespaceURI
String

属性の名前空間 URI。

返品

XmlElementに一致する属性ノードがない場合、削除されたXmlAttributeまたはnull

例外

このノードは読み取り専用です。

次の例では、要素から属性を削除します。

using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {

    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book xmlns:bk='urn:samples' bk:ISBN='1-861001-57-5'>" +
                "<title>Pride And Prejudice</title>" +
                "</book>");

    XmlElement root = doc.DocumentElement;

    // Remove the ISBN attribute.
    root.RemoveAttributeNode("ISBN", "urn:samples");

    Console.WriteLine("Display the modified XML...");
    Console.WriteLine(doc.InnerXml);
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()

    Dim doc as XmlDocument = new XmlDocument()
    doc.LoadXml("<book xmlns:bk='urn:samples' bk:ISBN='1-861001-57-5'>" & _
                "<title>Pride And Prejudice</title>" & _
                "</book>")

    Dim root as XmlElement = doc.DocumentElement

    ' Remove the ISBN attribute.
    root.RemoveAttributeNode("ISBN", "urn:samples")
    
    Console.WriteLine("Display the modified XML...")
    Console.WriteLine(doc.InnerXml)

  end sub
end class

適用対象