Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

XElement RemoveAll Method removes nodes and attributes from this XElement

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim root As XElement = _                  <Root Attr1="1" Attr2="2" Attr3="3">                     <Child1>1</Child1>                     <Child2>2</Child2>                     <Child3>3</Child3>                 </Root>                  root.RemoveAll()            Console.WriteLine(root)     End Sub End Class