XmlElement.RemoveAttributeAt(Int32) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定したインデックスを持つ属性ノードを要素から削除します。 (削除された属性に既定値がある場合は、すぐに置き換えられます)。
public:
virtual System::Xml::XmlNode ^ RemoveAttributeAt(int i);
public virtual System.Xml.XmlNode RemoveAttributeAt(int i);
public virtual System.Xml.XmlNode? RemoveAttributeAt(int i);
abstract member RemoveAttributeAt : int -> System.Xml.XmlNode
override this.RemoveAttributeAt : int -> System.Xml.XmlNode
Public Overridable Function RemoveAttributeAt (i As Integer) As XmlNode
パラメーター
- i
- Int32
削除するノードのインデックス。 最初のノードのインデックスは 0 です。
返品
属性ノードが削除されるか、指定されたインデックスにノードがない場合に null 。
例
次の例では、要素から属性を削除します。
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
"</book>");
XmlElement root = doc.DocumentElement;
// Remove the genre attribute.
root.RemoveAttributeAt(0);
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 genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>")
Dim root as XmlElement = doc.DocumentElement
' Remove the genre attribute.
root.RemoveAttributeAt(0)
Console.WriteLine("Display the modified XML...")
Console.WriteLine(doc.InnerXml)
end sub
end class
注釈
このメソッドは、ドキュメント オブジェクト モデル (DOM) のMicrosoft拡張機能です。