How do I parse an XML file that's on a different web server?
Posted
by Tim
on Stack Overflow
See other posts from Stack Overflow
or by Tim
Published on 2010-03-31T15:58:21Z
Indexed on
2010/03/31
16:03 UTC
Read the original article
Hit count: 270
I have a list of training dates saved into an XML file, and I have a little javascript file that parses all of the training dates and spits them out into a neatly formatted page. This solution was fine until we decided that we wanted another web-page on another sever to access the same XML file.
Since I cannot use JavaScript to parse an XML file that's located on another server, I figured I'd just use an ASP script. However, when I run this following, I get a response that there are 0 nodes matching a value which should have several:
<%
Dim URL, objXML
URL = "http://www.site.com/feed.xml"
Set objXML = Server.CreateObject("MSXML2.DOMDocument.3.0")
objXML.setProperty "ServerHTTPRequest", True
objXML.async = False
objXML.Load(URL)
If objXML.parseError.errorCode <> 0 Then
Response.Write(objXML.parseError.reason)
Response.Write(objXML.parseError.errorCode)
End If
Response.Write(objXML.getElementsByTagName("era").length)
%>
My question is two-fold:
- Is there are a way I can use java-script to parse a remote XML file
- If not, why doesn't my code give me the proper response?
© Stack Overflow or respective owner