Mega Code Archive

 
Categories / VB.Net / XML
 

Creates a XmlNode with the specified XmlNodeType, Prefix, Name, and NamespaceURI

Imports System Imports System.Xml public class Sample    public shared sub Main()         Dim doc as XmlDocument = new XmlDocument()        doc.LoadXml("<book>" & _                    "  <title>C#</title>" & _                    "  <price>5.95</price>" & _                    "</book>")         Dim newElem as XmlNode        newElem = doc.CreateNode(XmlNodeType.Element, "pages", "")          newElem.InnerText = "2"        Dim root as XmlElement = doc.DocumentElement        root.AppendChild(newElem)        Console.WriteLine(doc.OuterXml)    end sub end class