Bug reports, feature enhancements or other complaints with the site, with
us or just tell us what a miserable existance you have. No death threats or poetry please. Just kidding, no poetry please.
Any alternative to load function of XML DOM.
Date: August 06, 2008 11:07PM
Hi all,
I am stuck with a problem related to XML DOM . I was trying to parse the RSS feed given by BBC and display the feeds in my webpage thats running on localhost .
This is the code snippet
var xmlDoc=null;
if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("http://en-US.fxfeeds.mozilla.com/en-US/firefox/headlines.xml");
}
On doing so I get an error in firebug as "uncaught exception: Permission denied to call method XMLDocument.load" .
I also understand that load() has restrictions that the file that you want to load and the program thats loading it must be on the same server . I want to know is there any alternative to load() that I can use to get things running .
Shivkumar Lal
Re: Any alternative to load function of XML DOM.
Date: August 07, 2008 09:05AM
What you need is another script, servlet, or page (PHP, Java, .Net) that opens an HttpConnection to the URL you are passing to the load function and have it return the XML. These things are simple enough to write. Then, you would point the load function to the url of that page and you would be set.
-----------------------------------------------------------------------
(ú=(θ='',[µ=!(Φ=!θ+{})+θ,Θ=Φ[ø=+!θ]+Φ[+θ],ĩ=µ[ø],Ø=µ[º=ø+++ø],Ç=Φ[º+ø],à=ú[Φ[º+º]+Φ[+θ]+Ç+ĩ]][Ø+Ç+Θ])())[ĩ+à('•êí')](Ç+à('Á«)'))
Re: Any alternative to load function of XML DOM.
Date: August 07, 2008 02:42PM
what i think he is trying to say
firefox doesnt allow you to do a connection to outside your site
but say you create a php page called fetch.php
and did something like this
<?php
$fetch = file_get_contents("http://en-US.fxfeeds.mozilla.com/en-US/firefox/headlines.xml");
//(you should do some cleaning of it, so if a hacker comprimsed that page they could inject what ever on to your site, thats why this is just an example
echo $fetch;
?>
then in your javascript instead of
xmlDoc.load("http://en-US.fxfeeds.mozilla.com/en-US/firefox/headlines.xml");
it would be
xmlDoc.load("fetch.php");
i hope that helps explain a little better. if im wrong sorry, im not a pro at this stuff yet
http://www.xssed.com/archive/author=PaPPy/
Re: Any alternative to load function of XML DOM.
Date: August 07, 2008 04:34PM
Exactly what I was saying. I was just using Java terminology since I develop quite a bit in Java, although I have been known to do PHP too.
-----------------------------------------------------------------------
(ú=(θ='',[µ=!(Φ=!θ+{})+θ,Θ=Φ[ø=+!θ]+Φ[+θ],ĩ=µ[ø],Ø=µ[º=ø+++ø],Ç=Φ[º+ø],à=ú[Φ[º+º]+Φ[+θ]+Ç+ĩ]][Ø+Ç+Θ])())[ĩ+à('•êí')](Ç+à('Á«)'))