[thelist] ASP.NET parsing xml response with XMLDocument class

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Mon Oct 2 11:58:54 CDT 2006


   The XmlDocument class has a Load method, which can accept a Stream object as input.  If that doesn't work, the Load method is overloaded to accept a TextReader as well, which you can get from the StreamReader's ReadToEnd method.



						From: "Casey Crookston" caseyc at IntelliSoftmn.com 

Okay - on this little xml project I'm doing, I have now successfully
send the original HTTP Post to the remote server and received an XML
response. What I now need to do is parse the response with the .net
XMLDocument class. This is how I'm receiving the response:

Dim stIn As New StreamReader(req.GetResponse().GetResponseStream())

Now I need to add the contents of the stream reader to an XMLtext
variable. If I do it directly:

Dim xmlResponse As XmlText = stIn then it throws this error:

Value of type 'String' cannot be converted to 'System.Xml.XmlText'.

Understandable. So, I'm just wondering how I convert a string to xml so
I can then parse it out with XMLDocument.



More information about the thelist mailing list