I am trying to read an xml file using javascript in a jspx page. the code below is working using html and jsp but not jspx!!!!!?????

here are the functions, they are simple

function loadXMLDoc(xmlDir) {

if (window.XMLHttpRequest && navigator.appName != "Microsoft Internet Explorer") {
xhttp = new XMLHttpRequest();
else {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
return xmlDoc;

xhttp.open("GET", xmlDir, false);
return xhttp.responseXML;

function readXML() {
var xmlDoc = loadXMLDoc("resources/xml/test.xml");
var newel = xmlDoc.getElementsByTagName("NAME");
alert(newel.length); // this is what returns zero in jspx case


here is the xml file, locate it under web-inf>resources>xml

<?xml version="1.0" encoding="UTF-8" ?>

in jspx:
<f:facet name="metaContainer">
<af:resource type="javascript" source="resources/js/myjsFilel.js"/>

<af:commandButton text="commandButton 1" id="cb1">
<af:clientListener type="click" method="readXML"/>

your help is highly appreciated, thanks.