Solved

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

Posted on 2004-08-23
8
205 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to count occurrences of each item in an array.

743 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

9 Experts available now in Live!

Get 1:1 Help Now