sneeri_c
asked on
Delete from an XML File
I am using VB.NET 2005.
I want to delete from this XML File. If I have the following:
<?xml version="1.0" encoding="utf-8" ?>
<applicationlist>
<app>
<name>AC</name>
<srcdir>c:\AC</srcdir>
</app>
<app>
<name>NewAppInfo</name>
<srcdir>c:\Info</srcdir>
</app>
</applicationlist>
I want to delete one of the <app> sections of the xml. So I then have:
<?xml version="1.0" encoding="utf-8" ?>
<applicationlist>
<app>
<name>AC</name>
<srcdir>c:\AC</srcdir>
</app>
</applicationlist>
Thanks
I want to delete from this XML File. If I have the following:
<?xml version="1.0" encoding="utf-8" ?>
<applicationlist>
<app>
<name>AC</name>
<srcdir>c:\AC</srcdir>
</app>
<app>
<name>NewAppInfo</name>
<srcdir>c:\Info</srcdir>
</app>
</applicationlist>
I want to delete one of the <app> sections of the xml. So I then have:
<?xml version="1.0" encoding="utf-8" ?>
<applicationlist>
<app>
<name>AC</name>
<srcdir>c:\AC</srcdir>
</app>
</applicationlist>
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>")
Dim root As XmlNode = doc.DocumentElement
'Remove the title element.
root.RemoveChild(root.Firs
Console.WriteLine("Display
doc.Save(Console.Out)
End Sub