Magari ti può essere utile convertire il file letto in un oggetto javascript.
Immaginando di caricare in una variabile di nome doc il file XML restituito tramite responseXML dell'oggetto XMLHttpRequest, la variabile xml del codice seguente conterrà il tuo documento convertito in un oggetto (secondo la convenzione di Parker, più o meno)…
Può darsi che avere a che fare con un oggetto ti possa semplificare la vita… 
codice:
function buildValue(sValue) {
if (/^\s*$/.test(sValue)) { return(null); }
if (/^(true|false)$/i.test(sValue)) { return(sValue.toLowerCase() === "true"); }
if (isFinite(sValue)) { return(parseFloat(sValue)); }
if (isFinite(Date.parse(sValue))) { return(new Date(sValue)); }
return(sValue);
}
function getXMLData (oXMLParent) {
var vResult = /* true is the default value for empty nodes */ true, nLength = 0, sTxtContent = "";
if (oXMLParent.hasAttributes()) {
vResult = {};
for (nLength; nLength < oXMLParent.attributes.length; nLength++) {
iAttrib = oXMLParent.attributes.item(nLength);
vResult["@" + iAttrib.nodeName.toLowerCase()] = buildValue(iAttrib.nodeValue.replace(/^\s+|\s+$/g, ""));
}
}
if (oXMLParent.hasChildNodes()) {
var iKey, iValue, iXMLChild;
for (var iChildId = 0; iChildId < oXMLParent.childNodes.length; iChildId++) {
iXMLChild = oXMLParent.childNodes.item(iChildId);
if (iXMLChild.nodeType === 1 && !iXMLChild.prefix) {
if (nLength === 0) { vResult = {}; }
iKey = iXMLChild.nodeName.toLowerCase();
iValue = getXMLData(iXMLChild);
if (vResult.hasOwnProperty(iKey)) {
if (vResult[iKey].constructor !== Array) { vResult[iKey] = [vResult[iKey]]; }
vResult[iKey].push(iValue);
} else { vResult[iKey] = iValue; nLength++; }
} else if (iXMLChild.nodeType === 3) { sTxtContent += iXMLChild.nodeValue.replace(/^\s+|\s+$/g, ""); }
else if (iXMLChild.nodeType === 4) { sTxtContent += iXMLChild.nodeValue; }
}
}
if (nLength > 0) { vResult.keyValue = buildValue(sTxtContent); Object.freeze(vResult); }
else if (sTxtContent) { vResult = buildValue(sTxtContent); }
return(vResult);
}
var xml = getXMLData(doc);
// hai ottenuto il tuo file! prova a lanciare: alert(JSON.stringify(xml));