Loads the XML document from the specified string. : XML File Read « XML « VB.Net






Loads the XML document from the specified string.

 

Imports System
Imports System.Xml

public class Sample 

  public shared sub Main() 

    Dim doc as XmlDocument = new XmlDocument()
    doc.LoadXml("<item><name>A</name></item>")

    Dim newElem as XmlElement = doc.CreateElement("price")
    newElem.InnerText = "10.95"
    doc.DocumentElement.AppendChild(newElem)

    Dim writer as XmlTextWriter = new XmlTextWriter("data.xml",nothing)
    writer.Formatting = Formatting.Indented
    doc.Save(writer)
  end sub
end class

   
  








Related examples in the same category

1.Use XML Reader to display XML tag, Node type and attributesUse XML Reader to display XML tag, Node type and attributes
2.Load Xml document and print attributes
3.XmlTextReader: XmlNodeType Element, Text and EndElement XmlTextReader: XmlNodeType Element, Text and EndElement
4.Using XmlReaderSettings and XmlWriterSettings
5.Reading an XML file example
6.Is starting element
7.Loads the XML document from the specified TextReader.
8.LoadOptions.PreserveWhitespace