Solved

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

Posted on 2004-08-23
8
208 Views
Last Modified: 2010-04-06
I have to display a Yahoo! news feed on a webpage. This URL tells how to do it: http://www.elise.com/mt/archives/000242displaying_an_rss_newsfeed_on_your_site.php.

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>
0
Comment
Question by:yisraelharris
  • 3
  • 2
8 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 35 total points
ID: 11873939
You are not going to do it client side!  That is cross-domain scripting and it is prevented by built in security; and you would not want to use a browser that allowed it.  You say you don't have ASP.  So what so you have server side?  What you can do all depends on what you can or cannot do from your server, because its not going to happen on the client; and even if that code did work it is IE only.

Cd&
0
 

Author Comment

by:yisraelharris
ID: 11874445
Understood. Your explanation makes sense.

You ask what I have server side. The answer is that the Yahoo! feed needs to be displayed on a blog which is created through typepad.com. I am not sure what server side functionality they provide for displaying external files. I have just opened a help ticket with them, so we shall see.

I wonder if perhaps I will need to use a totally different technology for accessing a remote news feed in typepad.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 11875049
If it is free hosting on Yahoo, you probably won't have much hope; but if it is paid hosting they will probably have something you can use.  Without being able to do something server side there is not much you are going to be able to do other then just display the raw feed which is not a real alternative.

Cd&
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:yisraelharris
ID: 11877154
Typepad suggested that I use feedroll.com.

This seems like a possible solution. However, to use feedroll, you need to provide the source_id of the rss news feed you wish to display. I do not know the source_id for Yahoo! Mideast News. Any idea how I can determine this? (I have already submitted the question to Yahoo!.)
0
 
LVL 2

Assisted Solution

by:Epistemo
Epistemo earned 35 total points
ID: 11948164
feedroll has their id in their RRS format. This means that this is currently not available.
So instead of contacting Yahoo ... (they do not know the ID either since it is feeroll) you need to
contact feedroll and have them create the correct ID for you. They already have the Yahoo API it
seems and so that shouldn't take them to long.

You can't run any server scripts on Typepad?
0
 

Author Comment

by:yisraelharris
ID: 11950410
Thank you. I did indeed contact feedroll, and they very promptly got back to me with the correct ID. So I did indeed end up using feedroll.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now