XmlNamedNodeMap.RemoveNamedItem Metoda

Definicja

Usuwa określony węzeł z XmlNamedNodeMap .Removes the specified node from the XmlNamedNodeMap.

Przeciążenia

RemoveNamedItem(String)

Usuwa węzeł z XmlNamedNodeMap .Removes the node from the XmlNamedNodeMap.

RemoveNamedItem(String, String)

Usuwa węzeł z dopasowaniem LocalName i NamespaceURI .Removes a node with the matching LocalName and NamespaceURI.

RemoveNamedItem(String)

Usuwa węzeł z XmlNamedNodeMap .Removes the node from the XmlNamedNodeMap.

public:
 virtual System::Xml::XmlNode ^ RemoveNamedItem(System::String ^ name);
public virtual System.Xml.XmlNode RemoveNamedItem (string name);
public virtual System.Xml.XmlNode? RemoveNamedItem (string name);
abstract member RemoveNamedItem : string -> System.Xml.XmlNode
override this.RemoveNamedItem : string -> System.Xml.XmlNode
Public Overridable Function RemoveNamedItem (name As String) As XmlNode

Parametry

name
String

Kwalifikowana nazwa węzła do usunięcia.The qualified name of the node to remove. Nazwa jest zgodna z Name właściwością zgodnego węzła.The name is matched against the Name property of the matching node.

Zwraca

XmlNode

XmlNodeUsunięcie z tego XmlNamedNodeMap elementu lub null Jeśli nie odnaleziono zgodnego węzła.The XmlNode removed from this XmlNamedNodeMap or null if a matching node was not found.

Przykłady

Poniższy przykład używa XmlAttributeCollection klasy (która dziedziczy z), XmlNamedNodeMap Aby usunąć atrybut.The following example uses the XmlAttributeCollection class (which inherits from XmlNamedNodeMap) to remove an attribute.

#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' publicationdate='1997'>   <title>Pride And Prejudice</title></book>" );
   XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
   
   // Remove the publicationdate attribute.
   attrColl->RemoveNamedItem( "publicationdate" );
   Console::WriteLine( "Display the modified XML..." );
   Console::WriteLine( doc->OuterXml );
}

using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
     XmlDocument doc = new XmlDocument();
     doc.LoadXml("<book genre='novel' publicationdate='1997'> " +
                 "  <title>Pride And Prejudice</title>" +
                 "</book>");

     XmlAttributeCollection attrColl = doc.DocumentElement.Attributes;

     // Remove the publicationdate attribute.
     attrColl.RemoveNamedItem("publicationdate");

     Console.WriteLine("Display the modified XML...");
     Console.WriteLine(doc.OuterXml);
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()

    Dim doc as XmlDocument = new XmlDocument()
    doc.LoadXml("<book genre='novel' publicationdate='1997'> " & _
                "  <title>Pride And Prejudice</title>" & _
                "</book>")
                         
    Dim attrColl as XmlAttributeCollection = doc.DocumentElement.Attributes

    ' Remove the publicationdate attribute.
    attrColl.RemoveNamedItem("publicationdate")

    Console.WriteLine("Display the modified XML...")
    Console.WriteLine(doc.OuterXml)
    
  end sub
end class

Dotyczy

RemoveNamedItem(String, String)

Usuwa węzeł z dopasowaniem LocalName i NamespaceURI .Removes a node with the matching LocalName and NamespaceURI.

public:
 virtual System::Xml::XmlNode ^ RemoveNamedItem(System::String ^ localName, System::String ^ namespaceURI);
public virtual System.Xml.XmlNode RemoveNamedItem (string localName, string namespaceURI);
public virtual System.Xml.XmlNode? RemoveNamedItem (string localName, string? namespaceURI);
abstract member RemoveNamedItem : string * string -> System.Xml.XmlNode
override this.RemoveNamedItem : string * string -> System.Xml.XmlNode
Public Overridable Function RemoveNamedItem (localName As String, namespaceURI As String) As XmlNode

Parametry

localName
String

Lokalna nazwa węzła do usunięcia.The local name of the node to remove.

namespaceURI
String

Identyfikator URI przestrzeni nazw węzła do usunięcia.The namespace URI of the node to remove.

Zwraca

XmlNode

XmlNodeUsunięty lub null Jeśli nie odnaleziono zgodnego węzła.The XmlNode removed or null if a matching node was not found.

Dotyczy