Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created February 29, 2012 10:45
Show Gist options
  • Select an option

  • Save assertchris/1939843 to your computer and use it in GitHub Desktop.

Select an option

Save assertchris/1939843 to your computer and use it in GitHub Desktop.
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