Created
February 29, 2012 10:45
-
-
Save assertchris/1939843 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ns = 'http://ns'; | |
| function parse(text){ | |
| var parser = new DOMParser(); | |
| return parser.parseFromString(text, 'text/xml'); | |
| } | |
| var xml = parse('<!DOCTYPE html><html xmlns:glue="'+ns+'"><body><glue:if>something</glue:if></body></html>'); | |
| console.log(xml); | |
| console.log(xml.getElementsByTagNameNS(ns, 'if')); | |
| console.log(xml.getElementsByTagNameNS(ns, 'if').item(0).firstChild.nodeValue); | |
| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment