Hey i'm learning web programming by myself using W3Schools. I'm trying to learn how to link a xml on a html. Trying to do locally to start but can't manage to show the xml results. I did a button to load the XMLDoc and i 'think' i did the way it's showed on W3Schools but isn't working. Everything is normal except the button doesn't show anything thus the problem is on (xml parsing). The archives are on the same folder and i ran a XML validator to ensure the problem isn't on XML, also used Markup Validation Service and it said the code is fine. Could someone help me identify what i'm doing wrong?
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>HTML5 para Concurso!</title>
<link rel="stylesheet" href="Learning.css" >
</head>
<body>
<header>
<img width="100" height="60" src="https://logodownload.org/wp-content/uploads/2014/09/google-logo-1.png" alt="Logo da empresa">
</header>
<section>
<h1 title="Concurso" style="color:red;"> A máteria mais cobrada na área!</h1>
</section>
<main>
<article>
<img src="editais.png" alt="editais TRT e CODACA.">
<h2> A área de TI cresce em ritmo acelerado nos concursos. Aprenda hoje esse pilar que é o HTML5! </h2>
<a href="editais.html" target="_blank" style="background-color:yellow">
Acesse os editais </a>
</article>
<button type="button" onclick="loadXMLDoc()">
Mostrar aprovados!</button>
<p id="learning"></p>
<script>
function loadXMLDoc(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (this.readystate == 4 && this.status == 200){
myFunction(this);
}
};
xmlhttp.open("GET", "Learning.xml", true);
xmlhttp.send();
}
function myFunction(xml){
var x, i, xmlDoc, txt;
xmlDoc = xml.responseXML;
txt = "";
x = xmlDoc.getElementsByTagName("nome");
for (i = 0; i< x.length; i++) {
txt += x[i].childNodes[0].nodeValue + "<br>";
}
document.getElementById("learning").innerHTML = txt;
}
</script>
</main>
<footer style="border:2px solid Tomato"> Todos os direitos reservados LTDA </footer>
</body>
</html>