Thursday, July 3, 2008 STOP! This is an old post. Are you sure it's still relevant?

Read in a String of XML to an XPathDocument in ASP.NET

Had a string representation of an XML file today that needed to be read into an XPathDocument object.

// results was the string XML file representation
StringReader sReader = new StringReader(results);
XmlReader xReader = new XmlTextReader(sReader);
XPathDocument myXpathDocument = new XPathDocument(xReader);