1 |
wakaba |
1.1 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
2 |
|
|
<head> |
3 |
|
|
<title>DOM3 XPath and Default Namespace</title> |
4 |
|
|
</head> |
5 |
|
|
<body> |
6 |
|
|
<h1>DOM3 XPath and Default Namespace</h1> |
7 |
|
|
|
8 |
|
|
<p>XPath expression <code>//div</code> with <code>null</code> |
9 |
|
|
namespace resolver...</p> |
10 |
|
|
|
11 |
|
|
<dl> |
12 |
|
|
<dt><code><div xmlns=""/></code></dt> |
13 |
|
|
<dd><div xmlns="">DON'T MATCH</div></dd> |
14 |
|
|
<dt><code><div xmlns="http://www.w3.org/1999/xhtml"/></code></dt> |
15 |
|
|
<dd><div xmlns="http://www.w3.org/1999/xhtml">DON'T MATCH</div></dd> |
16 |
|
|
<dt><code><h:div xmlns:h="http://www.w3.org/1999/xhtml"/></code></dt> |
17 |
|
|
<dd><h:div xmlns:h="http://www.w3.org/1999/xhtml">DON'T MATCH</h:div></dd> |
18 |
|
|
</dl> |
19 |
|
|
|
20 |
|
|
<script type="text/javascript"> |
21 |
|
|
var nl = document.evaluate ('//div', document, null, |
22 |
|
|
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); |
23 |
|
|
for (var i = 0; i < nl.snapshotLength; i++) { |
24 |
|
|
nl.snapshotItem (i).textContent = 'MATCH'; |
25 |
|
|
} |
26 |
|
|
</script> |
27 |
|
|
|
28 |
|
|
</body> |
29 |
|
|
</html> |