Skip to content

Instantly share code, notes, and snippets.

@aurimasv
Created April 14, 2012 02:51
XML with xmlns XPath
ZU.doGet('https://resolve.eidr.org/EIDR/object/10.5240/6F7E-EF59-329B-1F0A-8440-2/?type=Full&followAlias=true',
function(text) {
var d = (new DOMParser()).parseFromString(text, "text/xml");
var nsResolver = function(prefix) {
var ns = {
'n' : 'http://www.eidr.org/schema/1.0',
'md': 'http://www.movielabs.com/md'
};
return ns[prefix] || null;
};
Z.debug(ZU.xpathText(d, './/n:Language', nsResolver));
}
);
/** THROWS ERROR
fileName => chrome://zotero/content/xpcom/utilities.js
lineNumber => 964
string => Error: NamespaceError: An attempt was made to create or change an object in a way which is incorrect with regard to namespaces
url => http://example.com
downloadAssociatedFiles => true
automaticSnapshots => true
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment