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);
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 노드입니다. 제거한 특성에 기본값이 있으면 바로 대체됩니다.

반환

XmlAttribute

제거한 XmlAttribute이거나, oldAttrnull의 Attribute 노드가 아닐 경우에는 XmlElement입니다.

예외

이 노드가 읽기 전용인 경우

적용 대상

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);
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입니다.

반환

XmlAttribute

제거한 XmlAttribute이거나 null에 일치하는 Attribute 노드가 없으면 XmlElement입니다.

예외

이 노드가 읽기 전용인 경우

예제

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

#using <System.Xml.dll>

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

적용 대상