make MODS work with Fx 4

This commit is contained in:
Simon Kornblith 2010-11-05 03:12:22 +00:00
parent 3409811b6c
commit 36cba09f6d
3 changed files with 11 additions and 8 deletions

View file

@ -238,7 +238,7 @@ Zotero.Translate.IO.Read = function(file, mode) {
}
Zotero.Translate.IO.Read.prototype = {
"__exposedProps__":["getXML", "RDF", "read", "setCharacterSet"],
"__exposedProps__":["_getXML", "RDF", "read", "setCharacterSet"],
"_seekToStart":function() {
this._rawStream.QueryInterface(Components.interfaces.nsISeekableStream)
@ -309,11 +309,11 @@ Zotero.Translate.IO.Read.prototype = {
}
},
"getXML":function() {
"_getXML":function() {
if(this._mode == "xml/dom") {
return Zotero.Translate.IO.parseDOMXML(this._rawStream, this._charset, this.file.fileSize);
} else {
return new XML(this._readToString().replace(/<\?xml[^>]+\?>/, ""));
return this._readToString().replace(/<\?xml[^>]+\?>/, "");
}
},

View file

@ -814,7 +814,10 @@ Zotero.Translate.Base.prototype = {
"};"+
"Zotero.Item.prototype.complete = function() { Zotero._itemDone(this); };"+
"Zotero.Collection = function () {};"+
"Zotero.Collection.prototype.complete = function() { Zotero._collectionDone(this); };");
"Zotero.Collection.prototype.complete = function() { Zotero._collectionDone(this); };"+
// https://bugzilla.mozilla.org/show_bug.cgi?id=609143 - can't pass E4X to sandbox in Fx4
"Zotero.getXML = function() { return new XML(Zotero._getXML()); }"
);
this._sandboxManager.importObject(this.Sandbox, this);
this._sandboxManager.importObject({"Utilities":new Zotero.Utilities.Translate(this)});
@ -1312,7 +1315,7 @@ Zotero.Translate.IO.String = function(string, uri, mode) {
}
Zotero.Translate.IO.String.prototype = {
"__exposedProps__":["getXML", "RDF", "read", "write", "setCharacterSet", "getXML"],
"__exposedProps__":["RDF", "read", "write", "setCharacterSet", "_getXML"],
"_initRDF":function() {
Zotero.debug("Translate: Initializing RDF data store");
@ -1375,11 +1378,11 @@ Zotero.Translate.IO.String.prototype = {
this.string.length += data.length;
},
"getXML":function() {
"_getXML":function() {
if(this._mode == "xml/dom") {
return Zotero.Translate.IO.parseDOMXML(this.string);
} else {
return new XML(this.string.replace(/<\?xml[^>]+\?>/, ""));
return this.string.replace(/<\?xml[^>]+\?>/, "");
}
},

View file

@ -508,7 +508,7 @@ function doImport() {
}
// try to get genre from local genre
for each(var genre in mods.m::genre) {
if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) {
if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre.text().toString())) {
newItem.itemType = genre.text().toString();
} else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) {
// otherwise, look at the marc genre