Fix CrossRef translator on some DOIs with different namespace

This commit is contained in:
Dan Stillman 2009-09-20 01:58:02 +00:00
parent 4278d60710
commit ac927f090d

View file

@ -8,7 +8,7 @@
"maxVersion":"",
"priority":90,
"inRepository":true,
"lastUpdated":"2009-09-18 01:05:00"
"lastUpdated":"2009-09-20 02:00:00"
}
function detectSearch(item) {
@ -40,10 +40,15 @@ function processCrossRef(xmlOutput) {
// "with ({});" needed to fix default namespace scope issue
// See https://bugzilla.mozilla.org/show_bug.cgi?id=330572
default xml namespace = "http://www.crossref.org/xschema/1.0"; with ({});
default xml namespace = "http://www.crossref.org/xschema/1.1"; with ({});
// ensure status is valid
if(!xml.doi_record.length()) return false;
if(!xml.doi_record.length()) {
// Fall back to older namespace
default xml namespace = "http://www.crossref.org/xschema/1.0";
if(!xml.doi_record.length()) {
return false;
}
}
// ensure this isn't an error
if(xml.doi_record.crossref.error.length()) {
throw xml.doi_record.crossref.error