How to read a Stream into an XElement

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top