<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<h2>XML workshop</h2>
<p id="demo"></p>
</div>
</div>
$(document).ready(function(){
var xhttp = new XMLHttpRequest();
var file = "https://cdn.sencha.com/ext/gpl/4.2.1/examples/form/xml-form-data.xml";
xhttp.onreadystatechange = function() {
if (this.readyState == 1 ) {
document.getElementById("demo").innerHTML = "Server Request Problem!";
} else if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", file, true);
xhttp.send();
function myFunction(xml) {
var x, y, i, xmlDoc, txt;
xmlDoc = xml.responseXML;
txt = "";
x = xmlDoc.documentElement;
y = x.childNodes;
for(i = 0; i < y.length; i++) {
txt += "NodenameUST: <span style='color:red'>" + y[i].nodeName +
"</span> (nodetypeUST: " + y[i].nodeType + ")<br>";
for(z = 0; z < y[i].childNodes.length; z++) {
txt += "NodenameUST: " + y[i].childNodes[z].nodeName +
" (DÜĞÜM TİPİUST: " + y[i].childNodes[z].nodeType + ")<br>";
}
}
document.getElementById("demo").innerHTML = txt;
}
});