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






Loads the XML document from the specified TextReader.

 


Imports System
Imports System.IO
Imports System.Xml

public class Sample 

  public shared sub Main() 
    ' Create the XmlDocument.
    Dim doc as XmlDocument = new XmlDocument()
    Dim xmlData as string = "<book xmlns:bk='urn:samples'></book>"

    doc.Load(new StringReader(xmlData))

    Dim elem as XmlElement = doc.CreateElement("bk", "genre", "urn:samples")
    elem.InnerText = "fantasy"
    doc.DocumentElement.AppendChild(elem)

    doc.Save(Console.Out)

  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 string.
8.LoadOptions.PreserveWhitespace