What is the perfered method in .NET over MSXML using XMLHTTPRequest?

M

Michael McCarthy

using MSXML.dll, I have the following code:

XMLHTTPRequest tempXML = new XMLHTTPRequest();
string strURL = "http://someURIgoeshere.com/";
try
{
tempXML.open("GET", strURL, false, "", "");
tempXML.send(null);
e.Result = tempXML;
}

....no problem. Now I want to get an XML Nodelist from the responseXML
object of my result... I'm stuck there using MSXML.. following that, I
need to pick out some information using getElementsByTagName but I cant
get to that place.

Any info on both the MSXML version vs. the propper .NET way of doing it
would be great... I'm thinking it would deal w/ an HTTPWebRequest, but I
haven't got THERE either.

regards,
Michael McCarthy.
 
J

Jon Skeet [C# MVP]

Michael McCarthy said:
using MSXML.dll, I have the following code:

XMLHTTPRequest tempXML = new XMLHTTPRequest();
string strURL = "http://someURIgoeshere.com/";
try
{
tempXML.open("GET", strURL, false, "", "");
tempXML.send(null);
e.Result = tempXML;
}

...no problem. Now I want to get an XML Nodelist from the responseXML
object of my result... I'm stuck there using MSXML.. following that, I
need to pick out some information using getElementsByTagName but I cant
get to that place.

Any info on both the MSXML version vs. the propper .NET way of doing it
would be great... I'm thinking it would deal w/ an HTTPWebRequest, but I
haven't got THERE either.

I'm not familiar with XMLHTTPRequest, so I don't know exactly what it
does, but if the idea is to read an XML document from HTTP, then
separating the concerns would seem to be a good idea. Use
HttpWebRequest to get a stream of data back from the web server, and
use XmlDocument.Load to load the stream into an XML document.
 

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