This documentation is archived and is not being maintained.
XmlNode::RemoveChild Method
Visual Studio 2010
Removes specified child node.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- oldChild
- Type: System.Xml::XmlNode
The node being removed.
| Exception | Condition |
|---|---|
| ArgumentException | The oldChild is not a child of this node. Or this node is read-only. |
The following example removes a node from the XML document.
#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>" ); XmlNode^ root = doc->DocumentElement; //Remove the title element. root->RemoveChild( root->FirstChild ); Console::WriteLine( "Display the modified XML..." ); doc->Save( Console::Out ); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: