Found a way that will load xml data from local files using xml data island.
Only tested with ie8 and no worky in FF (not tested in opera) the thing is that after I set the document either from xml island or xmlhttprequest most methods work on it (some need some tweaking with if statements).
I guess here it says that I should not use it but can't read it since it's blocked here in China. The reason is that it's only supported by IE? Use xmlhttprequest instead?? but that doesn't work with local files.
www.w3schools.com/xml/xml_dont.asp
Code:
<html>
<head>
<title>test course</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script>
function processData(){
var thisWorks=document.getElementById("xData").getElementsByTagName("info");
alert(thisWorks.length);
thisWorks=thisWorks[0];
alert(thisWorks.xml);
thisWorks=thisWorks.text;
alert(thisWorks);
}
function loadLesson(source){
var bla=document.getElementById("xData");
// document.getElementById("xData").onload=processData; could not find an event that is triggered when data is loaded
document.getElementById("xData").src=source;
processData(); // just hope the data is available.
}
</script>
</head>
<body onload='loadLesson("data.xml");' >
<xml id="xData" >
</xml>
</body>
</html>
Bookmarks