{ "translatorID": "e7243cef-a709-4a46-ba46-1b1318051bec", "label": "Citavi 5 XML", "creator": "Philipp Zumstein", "target": "xml", "minVersion": "3.0", "maxVersion": "", "priority": 100, "configOptions": { "dataMode": "xml/dom" }, "inRepository": true, "translatorType": 1, "lastUpdated": "2020-06-11 13:27:10" } /* ***** BEGIN LICENSE BLOCK ***** Copyright © 2016 Philipp Zumstein This file is part of Zotero. Zotero is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Zotero is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Zotero. If not, see . ***** END LICENSE BLOCK ***** */ /* TEST DATA can be found here: - Single reference (162 KB) text: https://gist.github.com/zuphilip/02d6478ace4636e4e090e348443c551e - Larger project (1221 KB): https://gist.github.com/zuphilip/76ce89ebbdac0386507b36cff3fd499a - Other project (1,11 MB): https://gist.github.com/anonymous/10fc363b6d79dae897e296a4327aa707 - Citavi 6 project (935 KB): https://gist.github.com/zuphilip/00a4ec6df58ac24b68366e32531bae4b */ function detectImport() { var text = Zotero.read(1000); return text.indexOf("0) { item.publisher = attachName(doc, publishers).join('; '); } var keywords = ZU.xpathText(doc, '//ReferenceKeywords/OnetoN[starts-with(text(), "'+item.itemID+'")]'); if (keywords && keywords.length>0) { item.tags = attachName(doc, keywords); } if (rememberTags[item.itemID]) { for (var j=0; j\n"; } if (text) { noteObject.note += "

" + ZU.xpathText(citations[j], 'Text') + "

\n"; } if (pages) { noteObject.note += "" + pages + ""; } if (rememberTags[noteObject.id]) { noteObject.tags = rememberTags[noteObject.id]; } if (noteObject.note != "") { item.notes.push(noteObject); } } //Locations will be saved as URIs in attachments, DOI, extra etc. var locations = ZU.xpath(doc, '//Locations/Location[ReferenceID="'+item.itemID+'"]'); //If we only have partial information about the callnumber or //library location, then we save this info in these two arrays //which will then processed after the for loop if no other info //was found. var onlyLibraryInfo = []; var onlyCallNumber = []; for (var j=0; j0) { item.callNumber = onlyCallNumber[0]; } else if (onlyLibraryInfo.length>0) { item.libraryCatalog = onlyLibraryInfo[0]; } } //Only for journalArticle and conferencePaper the DOI field is //currently established and therefore we need to add the info for //all other itemTypes in the extra field. if (item.DOI && item.itemType != "journalArticle" && item.itemType != "conferencePaper") { addExtraLine(item, "DOI", item.DOI); } //The items of type contribution need more data from their container //element and are therefore not yet finished. The other items can //be completed here. itemIdList[item.itemID] = item; if (type == "Contribution") { unfinishedReferences.push(item); } else { item.complete(); } } //For unfinished references we add additional data from the //container item and save the relation between them as well. for (var i=0; i< unfinishedReferences.length; i++) { var item = unfinishedReferences[i]; var containerString = ZU.xpathText(doc, '//ReferenceReferences/OnetoN[contains(text(), "'+item.itemID+'")]'); if (containerString) { var containerId = containerString.split(';')[0]; var containerItem = itemIdList[containerId]; if (containerItem.type == "ConferenceProceedings") { item.itemType = "conferencePaper"; } item.publicationTitle = containerItem.title; item.place = containerItem.place; item.publisher = containerItem.publisher; item.ISBN = containerItem.ISBN; item.volume = containerItem.volume; item.edition = containerItem.edition; item.series = containerItem.series; for (var j=0; j"; } else { item.note = "

" + ZU.xpathText(tasks[i], './Name') + "

"; } var noteText = ZU.xpathText(tasks[i], './Notes'); if (noteText) { item.note += "\n" + noteText; } item.seeAlso.push(ZU.xpathText(tasks[i], './ReferenceID')); item.tags.push("#todo"); item.complete(); } } function attachName(doc, ids) { if (!ids || !ids.length || ids.length<=0) { return ; } var valueList = []; var idList = ids.split(';'); //skip the first element which is the id of reference for (var j=1; j