XmlElement.RemoveAttributeNode Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Entfernt ein XmlAttribute.
Überlädt
| Name | Beschreibung |
|---|---|
| RemoveAttributeNode(XmlAttribute) |
Entfernt das angegebene XmlAttribute. |
| RemoveAttributeNode(String, String) |
Entfernt den XmlAttribute angegebenen durch den lokalen Namen und den Namespace-URI angegebenen. (Wenn das entfernte Attribut einen Standardwert aufweist, wird es sofort ersetzt). |
RemoveAttributeNode(XmlAttribute)
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
Entfernt das angegebene 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
Parameter
- oldAttr
- XmlAttribute
Der XmlAttribute zu entfernende Knoten. Wenn das entfernte Attribut über einen Standardwert verfügt, wird es sofort ersetzt.
Gibt zurück
Der entfernte XmlAttribute oder null wenn oldAttr kein Attributknoten der XmlElement.
Ausnahmen
Dieser Knoten ist schreibgeschützt.
Gilt für:
RemoveAttributeNode(String, String)
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
- Quelle:
- XmlElement.cs
Entfernt den XmlAttribute angegebenen durch den lokalen Namen und den Namespace-URI angegebenen. (Wenn das entfernte Attribut einen Standardwert aufweist, wird es sofort ersetzt).
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
Parameter
- localName
- String
Der lokale Name des Attributs.
- namespaceURI
- String
Der Namespace-URI des Attributs.
Gibt zurück
Das Entfernte XmlAttribute oder null wenn der XmlElement Knoten nicht über einen übereinstimmenden Attributknoten verfügt.
Ausnahmen
Dieser Knoten ist schreibgeschützt.
Beispiele
Im folgenden Beispiel wird ein Attribut aus einem Element entfernt.
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