How to read a Stream into an XElement

  • Thread starter Thread starter Anthony P.
  • Start date Start date
A

Anthony P.

I'm writing an application where I want to use Linq2XML to read a
simple bit of XML that's returned after executing a simple
HttpWebRequest. Once I execute the request and attach a response
stream, I'm executing this code to try to get the XML that's returned
into a standard string

Dim xmlReturnString as String = response.ReadToEnd()

After that, I'm then trying to attach that to an XElement like this:

Dim oXElement as XElement = xmlReturnString

On this statement, I get told that I can't convert a string into an
XElement.

How can I get the returned XML into an XElement so I can run some Linq
queries on it?

Thanks!
Anthony
 
Back
Top