Solved

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

Posted on 2004-08-23
8
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

739 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