How to read XML data stream via a URL address into a string ?

F

fniles

I know how to read XML from a file.
But I will need to load the XML content from a URL, so when I go to the URL,
the result is XML file, and I will need to capture the content to a string.
How can I do that ?
Thank you.
 
A

Anthony Jones

fniles said:
I know how to read XML from a file.
But I will need to load the XML content from a URL, so when I go to the
URL, the result is XML file, and I will need to capture the content to a
string.
How can I do that ?

Its unclear whether you want to do this client-side or server-side, I'll
assume (since you've posted to this group) that you need server-side code
and you are using VBScript.


Function GetXMLString(Url)

Dim xhr: Set xhr = CreateObject("MSXML2.ServerXMLHTTP.3.0")

xhr.Open "GET", sURL, false
xhr.Send
If xhr.Status = 200 Then
GetXMLString = xhr.responseText
End If
End Function

Why though would you want XML as a string ??
 
M

Martin Honnen

fniles said:
I need to parse the XML content and show it in an HTML table.

MSXML parses it for you normally with XMLHTTP or ServerXMLHTTP so you
should simply access the responseXML property, no need to try to parse
responseText.
 

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

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top