XmlElement.RemoveAttributeNode Méthode

Définition

Supprime un XmlAttribute.

Surcharges

Nom Description
RemoveAttributeNode(XmlAttribute)

Supprime le XmlAttribute.

RemoveAttributeNode(String, String)

Supprime le XmlAttribute nom local et l’URI d’espace de noms spécifiés. (Si l’attribut supprimé a une valeur par défaut, il est immédiatement remplacé).

RemoveAttributeNode(XmlAttribute)

Source:
XmlElement.cs
Source:
XmlElement.cs
Source:
XmlElement.cs
Source:
XmlElement.cs
Source:
XmlElement.cs

Supprime le 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

Paramètres

oldAttr
XmlAttribute

Nœud XmlAttribute à supprimer. Si l’attribut supprimé a une valeur par défaut, il est immédiatement remplacé.

Retours

Supprimé XmlAttribute ou null s’il oldAttr n’est pas un nœud d’attribut du XmlElement.

Exceptions

Ce nœud est en lecture seule.

S’applique à

RemoveAttributeNode(String, String)

Source:
XmlElement.cs
Source:
XmlElement.cs
Source:
XmlElement.cs
Source:
XmlElement.cs
Source:
XmlElement.cs

Supprime le XmlAttribute nom local et l’URI d’espace de noms spécifiés. (Si l’attribut supprimé a une valeur par défaut, il est immédiatement remplacé).

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

Paramètres

localName
String

Nom local de l’attribut.

namespaceURI
String

URI d’espace de noms de l’attribut.

Retours

Supprimé XmlAttribute ou null s’il XmlElement n’a pas de nœud d’attribut correspondant.

Exceptions

Ce nœud est en lecture seule.

Exemples

L’exemple suivant supprime un attribut d’un élément.

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

S’applique à