How to read a Stream into an XElement

Discussion in 'Microsoft VB .NET' started by Anthony P., Apr 18, 2010.

  1. Anthony P.

    Anthony P. Guest

    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
     
    Anthony P., Apr 18, 2010
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Daniel von Fersen

    Stream.Read in Bytearray Problem

    Daniel von Fersen, Apr 12, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    275
    Cor Ligthert
    Apr 12, 2004
  2. Guest

    Read from TCP Stream greater then buffer size

    Guest, Nov 27, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    1,132
    Guest
    Nov 28, 2004
  3. Giuseppe

    File To Stream - Stream To File

    Giuseppe, Mar 23, 2005, in forum: Microsoft VB .NET
    Replies:
    3
    Views:
    487
    Cor Ligthert
    Mar 23, 2005
  4. Inspired

    stuck into Stream.Read plz HELP !

    Inspired, Nov 29, 2005, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    205
    Inspired
    Nov 29, 2005
  5. Jack
    Replies:
    2
    Views:
    531
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Jul 18, 2007
  6. Rory Becker

    XElement, XAttribute Default Values

    Rory Becker, Jun 19, 2008, in forum: Microsoft VB .NET
    Replies:
    4
    Views:
    637
    Rory Becker
    Jun 25, 2008
  7. John Meyer

    XElement hell

    John Meyer, Jul 10, 2008, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    276
    John Meyer
    Jul 10, 2008
  8. fniles
    Replies:
    3
    Views:
    1,270
    Tom Shelton
    Feb 24, 2009
Loading...