私はこのbooks.xmlファイルをW3Schoolsからダウンロードしました。下のコード(with instructions from W3Schools)で解析しましたが、タイトルタグは解析されたコードには表示されません。私はあまりにも結果に表示されるタイトルタグを取得するにはどうすればよいXMLHttpRequestでこのXML文書からタイトルタグを表示しないのはなぜですか?
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
</head>
<body>
<p id="demo"></p>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
console.log("Up to this line works.");
}
};
xhttp.open("GET", "books.xml", true);
xhttp.send();
</script>
</body>
</html>
?
[W3Schoolsはこれまでよりも優れていますが、悪い習慣やセキュリティ上の問題が残っています。それは避けるのが最善です。](http://www.w3fools.com/)。 – Quentin