Solved

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

Posted on 2004-08-23
8
211 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

813 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

10 Experts available now in Live!

Get 1:1 Help Now