ballhogjoni Posted October 9, 2007 Share Posted October 9, 2007 I am using a script from w3schools and I try to parse an xml file, but I get a javascript error saying "access denied". Can someone help with this problem. my script <html> <head> <script type="text/javascript"> var xmlDoc; function loadXML() { //load xml file // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("http://www.xxxxxxxxx.com/partners/access/xml/xml.asp?uid=xxxxxxxxxxxx"); getmessage(); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); xmlDoc.load("http://www.xxxxxxxxxxxxxx.com/partners/access/xml/xml.asp?uid=xxxxxxxxxx"); xmlDoc.onload=getmessage; } else { alert('Your browser cannot handle this script'); } } function getmessage() { document.getElementById("category").innerHTML=xmlDoc.getElementsByTagName("category")[9].childNodes[0].nodeValue; <!--document.getElementById("from").innerHTML=xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;--> <!--document.getElementById("message").innerHTML=xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;--> } </script> </head> <body onload="loadXML()"> <h1>W3Schools Internal Note</h1> <p><b>To:</b> <span id="category"></span><br /> <b>From:</b> <span id="from"></span><br /> <b>Message:</b> <span id="message"></span> </p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/72468-xml-parsing-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.