Mega Code Archive

 
Categories / VB.Net / XML
 

Creates XmlNode based on the information in XmlReader

Option Explicit Option Strict Imports System Imports System.IO Imports System.Xml Public Class Sample     Public Shared Sub Main()         Dim doc As New XmlDocument()         doc.LoadXml("<bookstore>" & _                     "<book genre='Computer' ISBN='1-111111-57-5'>" & _                     "<title>C#</title>" & _                     "</book>" & _                     "</bookstore>")         Dim reader As New XmlTextReader("cd.xml")         reader.MoveToContent() 'Move to the cd element node.         Dim cd As XmlNode = doc.ReadNode(reader)         doc.DocumentElement.AppendChild(cd)         doc.Save(Console.Out)     End Sub  End Class