| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <title>DOMParser namespace support</title> | |
| 4 <script type="text/javascript"> | |
| 5 function execute() | |
| 6 { | |
| 7 if (window.testRunner) { | |
| 8 testRunner.dumpAsText(); | |
| 9 } | |
| 10 | |
| 11 var parser = new DOMParser(); | |
| 12 var str = | |
| 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"); | |
| 15 | |
| 16 document.getElementById("id1").firstChild.nodeValue = str; | |
| 17 document.getElementById("id2").firstChild.nodeValue = doc.getElementsByTagName
NS("foobar", "foo")[0].getAttribute("id"); | |
| 18 document.getElementById("id3").firstChild.nodeValue = doc.getElementsByTagName
NS("barfoo", "bar")[0].getAttribute("id"); | |
| 19 document.getElementById("id4").firstChild.nodeValue = doc.getElementsByTagName
NS("", "d")[0].getAttribute("id"); | |
| 20 document.getElementById("id5").firstChild.nodeValue = doc.getElementsByTagName
NS(null, "d")[0].getAttribute("id"); | |
| 21 } | |
| 22 | |
| 23 </script> | |
| 24 </head> | |
| 25 <body onload="execute();"> | |
| 26 | |
| 27 <p>text to parse</p> | |
| 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> | |
| 37 | |
| 38 </body> | |
| 39 </html> | |
| OLD | NEW |