XPATH 1.0 non supporta i namespace di default.
Sapete come posso risolvere il problema in javascript nel seguente semplice codice?


Codice XML.
codice:
<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore desc="Barnes" xmlns="spaziodeinomididefault">
bookstore1
<book category="COOKING">
libro1
  <title lang="it">Everyday Italian</title>
  <author>Giada De Laurentiis</author>
  <year>2005</year>
  <price>30.00</price>
</book>
<manual category="GIARDINAGGIO">
manuale1
  <title lang="en">Everyday Italian Manual</title>
  <author>Giada De Laurentiis</author>
  <year>2005</year>
  <price>90.00</price>
</manual>
<book category="CHILDREN">
libro2
  <title lang="it">Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>
<book category="WEB">
libro3
  <title country="en">XQuery Kick Start</title>
  <author>James McGovern</author>
  <author>Per Bothner</author>
  <author>Kurt Cagle</author>
  <author>James Linn</author>
  <author>Vaidyanathan Nagarajan</author>
  <year>2003</year>
  <price>49.99</price>
</book>

<book category="WEB">
libro4
  <title>Learning XML</title>
  <author>Erik T. Ray</author>
  <year>2003</year>
  <price>39.95</price>
</book>

</bookstore>
Codice Javascript
codice:
<html>
<body>
<script type="text/javascript">
xhttp = new XMLHttpRequest();
xhttp.open("GET", "books.xml", false);
xhttp.send("");
xml = xhttp.responseXML;

path = "/bookstore/book"
nodes = xml.evaluate(path, xml, null, XPathResult.ANY_TYPE, null);
result = nodes.iterateNext();

while (result) {
	document.write(result.childNodes[0].nodeValue);
	document.write("
");
	result = nodes.iterateNext();
}
</script>

</body>
</html>
Grazie dell'attenzione