Fix importing Citavi annotations in some cases

This commit is contained in:
Tom Najdek 2022-08-18 14:13:36 +02:00 committed by Dan Stillman
parent 0695154661
commit cff02b04a0

View file

@ -9,6 +9,9 @@ const parseCitavi5Quads = (quadsRaw) => {
const ImportCitaviAnnotatons = async (translation) => { const ImportCitaviAnnotatons = async (translation) => {
const IDMap = translation._itemSaver._IDMap; const IDMap = translation._itemSaver._IDMap;
const ZU = translation._sandboxZotero.Utilities; const ZU = translation._sandboxZotero.Utilities;
// stream might be closed by now, re-init to make sure getXML() works
translation._io.init('xml/dom');
const doc = translation._sandboxZotero.getXML(); const doc = translation._sandboxZotero.getXML();
const isCitavi5 = ZU.xpathText(doc, '//CitaviExchangeData/@Version').startsWith('5'); const isCitavi5 = ZU.xpathText(doc, '//CitaviExchangeData/@Version').startsWith('5');
var annotationNodes = ZU.xpath(doc, '//Annotations/Annotation'); var annotationNodes = ZU.xpath(doc, '//Annotations/Annotation');