3 <title>DOMParser namespace support
</title>
4 <script type=
"text/javascript">
7 if (window
.testRunner
) {
8 testRunner
.dumpAsText();
11 var parser
= new DOMParser();
13 '<?xml version="1.0"?>\n<doc>\n <foo xmlns="foobar" id="1">One</foo> <x:bar xmlns:x="barfoo" id="2">Two</x:bar>\n <d id="3">Three</d>\n</doc>\n';
14 var doc
= parser
.parseFromString(str
,"text/xml");
16 document
.getElementById("id1").firstChild
.nodeValue
= str
;
17 document
.getElementById("id2").firstChild
.nodeValue
= doc
.getElementsByTagNameNS("foobar", "foo")[0].getAttribute("id");
18 document
.getElementById("id3").firstChild
.nodeValue
= doc
.getElementsByTagNameNS("barfoo", "bar")[0].getAttribute("id");
19 document
.getElementById("id4").firstChild
.nodeValue
= doc
.getElementsByTagNameNS("", "d")[0].getAttribute("id");
20 document
.getElementById("id5").firstChild
.nodeValue
= doc
.getElementsByTagNameNS(null, "d")[0].getAttribute("id");
25 <body onload=
"execute();">
28 <p id=
"id1">@@No result@@
</p>
29 <p>foobar:foo element
</p>
30 <p id=
"id2">@@No result@@
</p>
31 <p>barfoo:bar element
</p>
32 <p id=
"id3">@@No result@@
</p>
33 <p>d element (empty namespace)
</p>
34 <p id=
"id4">@@No result@@
</p>
35 <p>d element (null namespace)
</p>
36 <p id=
"id5">@@No result@@
</p>