Question: I have a string that contains well formed xml in it. I want to navigate the XML in that string to extract the text in certain nodes. How do I efficiently accomplish this using a built-in .NET class. Which .NET XML class would you use and why? 

Many thanks for your help.

Note 1: Linq is not available to me.
Note 2: Editing the XML is not important. Read-only access is what I need.

Answer: 
For navigation? Probably [`XPathDocument`](http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathdocument.aspx):

```
string s = @"<xml/>";
XPathDocument doc = new XPathDocument(new StringReader(s));

```

From MSDN,

> 
> Provides a fast, read-only, in-memory representation of an XML document by using the XPath data model.
> 
> 
> 

Unlike `XmlDocument` etc, it is optimised for readonly usage; more efficient but less powerful (i.e. you can't edit it). For notes on how to query it, [see here](http://support.microsoft.com/kb/308333).
It depends on the structure of XML. If it is relatively simple, then the most efficient way to wrap the string into `StringReader`, and then wrap that into `XmlReader`. The benefit is that you won't have to create an XML tree in memory, copying data from the string - you'll just read nodes one by one.

If the document structure is complicated enough, you might need (or want) a DOM - in which case `XDocument.Parse` should do the trick.