O'Reilly logo

Microsoft® .NET Compact Framework Kick Start by Ronnie Yates, Erik Rubin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Skipping over Nodes

Many times when reading an XML stream, you find that you are searching for one particular node or parent node in the document that meets a certain criterion. The XmlTextReader does not provide any methods that will allow you to find one particular node quickly. Therefore, searching an XML stream with the XmlTextReader can be both complicated and processor intensive. These issues can be alleviated if you design your XML data carefully. Listing 10.19 illustrates how to build a method that will search for a given error message in an XML document with the Skip method.

Listing 10.19.
 C# public string FindErrorMessage(string filename, int catNumber, int errorNumber) { XmlTextReader reader = new XmlTextReader(filename); reader.WhitespaceHandling ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required