Welcome to WebmasterWorld Guest from 54.163.100.58

Forum Moderators: httpwebwitch

Loading External XML file: works server-side, but not client-side

   
6:27 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



I have to display a Yahoo! news feed on a webpage. This URL tells how to do it: [elise.com...]

The logic is simple, and it works great:
1. Create an object and load your xsl file (which I created)
2. Create an object and load your xml file (the Yahoo! news feed)
3. Use the "transformNode" method for your output.

Trouble is, it uses ASP, and I must use html. I tried to 'convert' the ASP code into clientside javascript, and it works fine -- on my computer. But then when I upload the html file to my server and run it, I get "access denied" on the line that tries to open the Yahoo! feed. The code is below.

I tried the following variations, but none of them solved the problem:
1. Instead of Microsoft.XMLDOM, Msxml2.DOMDocument
2. Instead of Microsoft.XMLDOM, Msxml2.DOMDocument.4.0
3. The command: xmldoc.setProperty("ServerHTTPRequest", true)

Now you have the complete context, but what it really boils down to is loading an external xml file from clientside javascript. Maybe it is not possible?

Any solutions would be very welcome. Thank you.

Here is the code:

<html>
<body></body>
<script>
xsldoc = new ActiveXObject("Microsoft.XMLDOM")
xsldoc.async = false
xsldoc.load("rss.xsl")
xmldoc = new ActiveXObject("Microsoft.XMLDOM")
xmldoc.async = false
xmldoc.load("http://rss.news.yahoo.com/rss/mideast")<!--HERE IS THE PROBLEM-->
document.write(xmldoc.transformNode(xsldoc))
</script>
</html>

8:53 pm on Aug 24, 2004 (gmt 0)

10+ Year Member



Instead of just the load method, try the loadXml method:
xmldoc.load("http://rss.news.yahoo.com/rss/mideast")

xmldoc.loadXml("http://rss.news.yahoo.com/rss/mideast")

9:08 pm on Aug 24, 2004 (gmt 0)

10+ Year Member



Thank you for the suggestion.

I was told on another forum that what I want to do is simply not allowed, and it kind of makes sense to me.

I was told of a totally different way to get the job done: feedroll.com. It works quite nicely.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month