Loading XML Documents
Loading of an XML document is accomplished by calling the Load() method, which reads XML data
and populates the document tree structure. There are four different versions of the Load() method, each
of which uses a different source to read the data. Here are the various forms of the Load() method:
❑ Load(Stream): Loads the document from a Stream data source
❑ Load(string): Loads the document using the given file name string
❑ Load(TextReader): Loads the document using a TextReader as the data source
❑ Load(XmlReader): Loads the document using the given XmlReader as the data source
In addition to taking a Stream, TextReader, and XmlReader objects, the Load() method also takes in a
file name as a string argument. Using this method, you can load an XML document from the specified
URL. Apart from the overloaded Load() methods, there is also a method named LoadXml() that makes
it possible to load the XML document from a string of data as its argument.