Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading XML from a different server?

Status
Not open for further replies.

Supra

Programmer
Dec 6, 2000
422
US
Hello!

What I'm trying to do is load an XML file from someone else's server and use the information in that file to display on my website. I wrote the following code which works great on my desktop, but when I upload the file, no go ;(
Code:
<script>
<!--
function checkState() {
	var mainNode = XMLSrc.selectSingleNode("//firstNode/secondNode");
	var info = mainNode.getAttributeNode("info").text;
}
//-->
</script>

<xml id="XMLSrc" src="[URL unfurl="true"]http://www.someserver.com/somexmlfile.xml"[/URL] ondatasetcomplete="checkState();"></xml>
I've also noticed that the ondatasetcomplete event doesn't seem to fire when I upload the file to my website. But I used onreadystatechange instead, so that's not a big deal. So the only real question is, is this like IFrames where you're denied access from the DOM of pages loaded in an IFrame if they are located in a different domain, or is the way I'm loading this XML file not acceptable? It seems like a pretty cheap way to do it because I'm avoiding Ajax altogether, but it was the easiest! Also, I do have access to Perl, but when I tried using LWP to load the XML file and specifying the content-type as text/xml, it wouldn't work - I got some sort of "instructions not closed" error or something. Anyway, any help you could offer would be great!!
 
One way is to add the site where the web page containing the data island (not the site of the source of the data island) is served to the list of trusted site in the security zone setting of ie. You have to evaluate the risk and reward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top