The first thing to do when parsing an XML document with an XmlTextReader is to load the stream into the reader. To do this, you simply need to create an instance of the XmlTextReader and tell it where it can find the document. The .NET Compact Framework provides several overloaded constructors for loading an XmlTextReader from different sources.
The easiest way to create an instance of the XmlTextReader is to call the constructor that takes a string representing the URI to where the XML document can be found, as shown in Listing 10.1.
C# XmlTextReader reader = new XmlTextReader("filename.xml"); VB Dim reader As New XmlTextReader("filename.xml") ...