
function loadXmlFile(file){

  // Criando um objeto XML Parser
  try { 
    // Chamada compatível com Internet Explorer
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  } catch(e) {
     try {
       // Chamada compatível com Firefox, Mozilla, Opera, etc. 
       xmlDoc=document.implementation.createDocument("","",null);
     } catch(e) {
       alert(e.message);
       return;
     }
  }
  xmlDoc.async=false;

  // Carregando o arquivo no objeto
  xmlDoc.load(file);

  return xmlDoc;

}

function getListOfXmlElements(xmlDoc, key){
  return xmlDoc.getElementsByTagName(key);  
}

function getXmlValue(xmlDoc, key) {
  try {
    return xmlDoc.getElementsByTagName(key)[0].childNodes[0].nodeValue;
  } catch(e) {
    return "";
  }
}

