For given name retrieve it's score :
function getScoreByName(nameparam, xml){
var nameList = xml.getElementsByTagName('name');
for(var i=0; i<nameList.length; i++){
if(nameparam === nameList[i].firstChild.nodeValue){
//parentNode = <emp>
//lastChild = <score>
handleAttempts(nameList[i].parentNode.lastChild.childNodes);
//print name here
}
}
}
function handleAttempts(attemptList){
var percentage;
var result;
var examName;
for(var i=0; i<attemptList.length; i++){
percentage=attemptList[i].childNodes[0].firstChild.nodeValue;
result=attemptList[i].childNodes[1].firstChild.nodeValue;
examName=attemptList[i].childNodes[2].firstChild.nodeValue;
//print attempt here
}
}