This is the code where I am trying to add an external XML:
PHP Code:
<html>
<head>
<script>
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}
function displayResult()
{
xml=loadXMLDoc("movies.xml");
xsl=loadXMLDoc("movies.xsl");
// code for IE
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
</script>
</head>
<body onload="displayResult()">
<div id="example" />
</body>
</html>
I thought I can change this line:
PHP Code:
xml=loadXMLDoc("movies.xml");
into:
PHP Code:
xml=loadXMLDoc("http://www.example.com/feed/");
But it doesn't work.
Also couldn't do it with something like this. Just because I am having mistakes with the way I am writing it.
PHP Code:
string url = "http://example.com/feed/";
WWW www = new WWW(url);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(www.data);
Thanks in advance.