XmlElement.RemoveAttributeAt(Int32) 메서드

정의

요소에서 지정된 인덱스의 특성 노드를 제거합니다. 제거한 특성에 기본값이 있는 경우 즉시 바뀝니다.

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이 있습니다.

반환

XmlNode

제거한 Attribute 노드이거나, 지정한 인덱스에 노드가 없는 경우에는 null입니다.

예제

다음 예제에서는 요소에서 특성을 제거합니다.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew 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 );
}
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 확장입니다.

적용 대상