Failure to import .xml file from Citavi

I followed instructions for exporting my library from Citavi 5 to Zotero (https://www.zotero.org/support/kb/importing_standardized_formats)

I renamed the .cit5bak file to .xml as directed (though the .cit5bak file was not zipped, whereas the linked instructions said it would be) and copied all the pdfs from the relevant Citavi folder into the same folder as the .xml, for import into Zotero.

When I tried to import the .xml file into Zotero I got an error code: 111293816
and an instruction to post the number here for review.

Thanks for any help...
Dan
  • I should add that I'm using Zotero 5.0.57 for Mac
  • you're sure that ctv5bak wasn't zipped? Did you try renaming it to .zip and opening?
  • Hi Adamsmith thanks for your help. As you suggested I renamed the cit5bak file to .zip, double clicked to 'extract all' which created a .cit5 file, which I was then able to directly import into Zotero. I didn't have to rename to .xml as the guidelines that I linked in my original question stated I should. At any rate - all sorted!
  • Hi, I have the same problem. My folder is not zipped (already .ctv5) and after renaming (xml) and trying to import it says error. Any suggestions?
    Does Zotero import the PDFs if they are in the same folder?
    Thanks a lot!
  • Can you open the .ctv5 file with a text editor like notepad?
  • You need to start with a backup file ctv5bak of your project, see https://www.zotero.org/support/kb/import-from-citavi . (The normal ctv5 file of your project is actually SQLITE file, but we need ctv5 file which is a XML representation. You "see" the difference if you just try to open one of the files in a text editor.)
  • Is this export import procedure still working with the latest version of Zotero. I have a citavi5 xml file (created according to the instructions at https://www.zotero.org/support/kb/import-from-citavi) but when I try to import it with Zotero, Zotero freezes (becomes nonresponsive). I have several thousand items in my citavi database, but I'm hardly the first one to try importing such a database into zotero, right? So maybe the import function in zotero is broken?
  • freezing is not a sign of being broken, that's just a sign of being busy. How long have you let it run? For a large-ish database, might easily take a couple of hours. I'd also recommend shutting down other apps so Zotero doesn't run out of RAM during import.
  • edited December 30, 2020
    When Windows says over an extended period of time that an application is not responsive then this is almost always a sign that the application has crashed. I let it run for almost an hour. I then killed it because it had no disk activity. I assumed that if Zotero was just very busy, it would be reading and writing the hard drive from time to time. But in retrospect I realise that it is possible that it performs all operations entirely in memory before writing the results to disk. But even then (or especially then) I don't see how this process could take more than, say, 30 minutes. We are talking about processing text!

    I have 24 GB of RAM on my PC, and at least 10 GB are free at virtually any time.

    Could someone confirm that the import from citavi 5 is working with the latest version of Zotero? Because if it isn't, there is no point in spending lots of time trying...
  • Yes, definitely still works, this is a test file with 120 items that imports into current Zotero without issues: https://gist.github.com/zuphilip/76ce89ebbdac0386507b36cff3fd499a

    You can check if your xml file looks markedly different, but large imports into Zotero can indeed take much longer than 30mins and may very well freeze in the process. No harm in letting it run overnight or in the background while you do something else.

    It might still crash due to memory issues-- Zotero isn't great with managing memory on imports, but it would actually crash (i.e. shut down) in that case.
  • Thanks, adamsmith! It looks like my import eventually went through, but when I came back to the computer after letting it run for a while, Zotero was closed. Is it normal for Zotero to exit after the import or does this mean that it crashed during the import?

    Looking at the imported titles, I notice that only a fraction of the information for each title seems to have been imported, so maybe it crashed?

    Here are some of the fields that I would have expected to be transferred from the XML file into Zotero but wheren't:

    1. Language
    2. Short Title
    3. Related titles (as linked in Citavi)
    4. sequence number (ID)
    5. Categories
    6. Date added
    7. Date modified
    8. Library catalogue and call number
    9. number of pages

    If any of these are not imported by design, is there any way of modifying the import process to include these?
  • Is it normal for Zotero to exit after the import or does this mean that it crashed during the import?
    No, that's only happen when it crashes, likely due to memory issues.

    Of the items listed, Sequence number, Date added, Date modified wouldn't import on purpose, the former because it doesn't exist in Zotero, the latter because they're set at the database level in Zotero. I think item relations are a beast to import, so we're probably not super likely to do that.

    Are categories the same as keywords and tags?
    The other fields should be easily doable.
  • What kind of memory issues? I don't see how it can be due to lack of RAM. I have over 10 GB unused RAM...

    I have used the sequence number as a unique identifier in various places and would very much like to preserve it. I read somewhere that fields that don't have a corresponding field in Zotero will be written into the extra field (and I have seen that happen in some cases). Is there any way of controlling which fields get written into the extra field?

    Losing the date added and date modified fields would also be an unecessary loss of information (it may sound strange, but seeing when I added a refrence and when I last edited it implies quite a lot of things). Is it not possible to tell the database to set these fields based on the imported values upon import? After that, the date modified should of course be updated as usual.

    Item relations: doesn't that exist as "Related" in Zotero?

    In Citavi, categories serve a different purpose than keywords (keywords describe the content of the item, a typical use for categories are outline headings or research questions within a project or manuscript), but technically they are the same (except that categories can be nested) so they could be imported into tags. SInce category names start with a number, they would be easily distinguishable from keyword-tags. But they might also make the tags box in zotero overcrowded because category names can be quite long (like headings). If collections can be nested and if a reference can simultaneously be in multiple collections, it might make more sense to import categories into collections.

    So, by "easily doable" you mean what? Is there a file that I can edit?
  • Quick update: While the import on my Windows machine with 24 GB RAM keeps failing, I managed to import the file on my Mac mini (which has 8 GM RAM). It takes a while but it works.

    I also found the Citavi XML translator file and tried to modify it so that it would import some additional fields into the extra field, but I didn't succeed. Once I modified the file, the import failed.

    What I tried to do is use existing lines of code, that import a field into the extras field and modify it, but there seems to be more to it that just that. Could someone give me a hint?
  • What kind of memory issues? I don't see how it can be due to lack of RAM. I have over 10 GB unused RAM...
    Zotero on Windows is still 32-bit and can only use 3 GB of RAM, which can be a problem with large imports for translators that haven't been updated to process items individually. That's why it worked on macOS.

  • What I tried to do is use existing lines of code, that import a field into the extras field and modify it, but there seems to be more to it that just that. Could someone give me a hint?
    Could you say a bit more about what you tried to modify with what goal?
  • edited February 22, 2021
    Thanks @dstillman, thanks for solving that mystery. So, in case anyone else is wondering: I have about 7500 references in my Citavi database. I suppose the memory use also depends on other factors, but for now, I'd say: if your database is around that size and your import on windows fails, try doing the same on Mac.

    @adamsmith I really appreciate your help. Here is the part of the Citavi 5 XML.js that I modified. The added lines are marked with "// added" at the end of the line. These are not the only modifications I would like to make but I thought I'd start with that.


    //Main information for each reference.
    var item;
    var references = ZU.xpath(doc, '//References/Reference');
    var unfinishedReferences = [];
    var itemIdList = {};
    for (var i=0, n=references.length; i<n; i++) {
    var type = ZU.xpathText(references[i], 'ReferenceType');
    if (type && typeMapping[type]) {
    item = new Zotero.Item(typeMapping[type]);
    } else {
    Z.debug("Not yet supported type: " + type);
    Z.debug("Therefore use default type 'journalArticle'");
    item = new Zotero.Item("journalArticle");
    }
    item.itemID = ZU.xpathText(references[i], './@id');
    //Z.debug(item.itemID);

    item.title = ZU.xpathText(references[i], './Title');
    var subtitle = ZU.xpathText(references[i], './Subtitle');
    if (subtitle) {
    item.title += ": " + subtitle;
    }
    item.abstractNote = ZU.xpathText(references[i], './Abstract');
    item.url = ZU.xpathText(references[i], './OnlineAddress');
    item.volume = ZU.xpathText(references[i], './Volume');
    item.issue = ZU.xpathText(references[i], './Number');
    item.DOI = ZU.xpathText(references[i], './DOI');
    item.ISBN = ZU.xpathText(references[i], './ISBN');
    item.edition = ZU.xpathText(references[i], './Edition');
    item.place = ZU.xpathText(references[i], './PlaceOfPublication');
    item.numberOfVolumes = ZU.xpathText(references[i], './NumberOfVolumes');

    addExtraLine(item, "PMID", ZU.xpathText(references[i], './PubMedID'));
    addExtraLine(item, "Citavi-ID", ZU.xpathText(references[i], './SequenceNumber')); // added
    addExtraLine(item, "Created", ZU.xpathText(references[i], './CreatedOn')); // added
    addExtraLine(item, "Modified", ZU.xpathText(references[i], './ModifiedOn')); // added
    addExtraLine(item, "BibTeXKey", ZU.xpathText(references[i], './BibTeXKey')); // added



    item.pages = extractPages(ZU.xpathText(references[i], './PageRange'));
    item.numPages = extractPages(ZU.xpathText(references[i], './PageCount'));

    item.date = ZU.xpathText(references[i], './DateForSorting') ||
    ZU.xpathText(references[i], './Date') ||
    ZU.xpathText(references[i], './Year');
    item.accessDate = ZU.xpathText(references[i], './AccessDate');


    Another issue I'm seeing, even when I use the original translation file is that the attached pdf files are not getting imported. At first, I figured that this is due to the fact that the file paths on Mac don't match the ones in the Citavi database, so I edited the xml file to change

    <AttachmentsFolderPath>L:\</AttachmentsFolderPath>

    to

    <AttachmentsFolderPath>/Users/christoph/Documents/Box Sync/Literature/</AttachmentsFolderPath>

    but to no avail. What could be the reason for attachments not being imported (I used the setting to leave the files where they are and link them, not to import them)?
  • You'd need to wrap xml into <code> </code> to be visible here
  • > You'd need to wrap xml into to be visible here

    Oops. I edited the post above accordingly.
  • The added code looks & works fine for me -- do run it in scaffold for easier debugging or look at error reports after a failed import.

    For the files, not item 4. here: https://www.zotero.org/support/kb/import-from-citavi
  • > For the files, not item 4. here: https://www.zotero.org/support/kb/import-from-citavi

    Oh, sorry about that. I had seen and followed that previously but somehow I forgot about it again.

    My import using the modified Citavi 5 XML.js also seems to work now. I suspect that I unintentionally modified the file somewhere else, so I started anew with the original.

    Now, the one big thing that is missing at this point are the relationships between items. Since Zotero also has this feature (related), it would make sense to import those as well. But I'm not sure how this can be accomplished.

    I believe that in the Citavi XML file, these relationships are stored towards the end of the file as EntityLinks. They look like this:


    <EntityLink id="aa00ace0-8d48-475b-8d52-4b8ba9ba8f1d">
    <ModifiedBy>ch</ModifiedBy>
    <ModifiedOn>2014-06-27T18:28:36</ModifiedOn>
    <Indication>ReferenceLink</Indication>
    <Notes>Note about this relationship</Notes>
    <RelationType>0</RelationType>
    <Source>645699e9-7877-40ad-8e83-91e8d50b8999:Reference</Source>
    <SourceData>156</SourceData>
    <SourceID>645699e9-7877-40ad-8e83-91e8d50b8999</SourceID>
    <SourceType>Reference</SourceType>
    <Target>feb5508f-727d-4d19-996e-147083cc98d7:Reference</Target>
    <TargetID>feb5508f-727d-4d19-996e-147083cc98d7</TargetID>
    <TargetType>Reference</TargetType>
    </EntityLink>


    The Notes field is only present if there actually is a note. (I'm not sure if zotero allows for comments on relationships and I can't check because it is currently blocked by the ongoing import, but it would be great if those notes could also be imported. But let's safe that for later.)

    Examples of other values in the indication-field, are PdfKnowledgeItem and SourceAnnotLink. Not sure what those are, but for now I'll assume that it's the ReferenceLink-type LinkEntities we want.

    So, in my mind, what the translator would have to do (for those entity links that are ReferenceLinks) is "merely" map the SourceID and TargetID onto the items in Zotero and create a "related"-record for those two items. Since the translator is already using reference IDs (which correspond to SourceID and TargetID), I'm optimistic that this is possible. Not sure, though, how to create a related item...
  • The importer should already preserve relations (though you can't comment on relations in Zotero -- it doesn't aim to be a knowledge management tool like Citavi), but this currently looks to me like it's broken on import --

    @dstillman could you confirm that? I'm not seeing relations preserved on export/import in any translator.
  • >The importer should already preserve relations

    This is excellent news! How about the direction of the relation (which item is referring to which)? Is that also preserved?

    Another challenge I encountered is that all my most important notes/annotations in Citavi are associated to one or more categories (representing for which project or paper or section of a paper they are relevant). Since Zotero does allow notes to have relations, one way of translating those relations to categories would be to create a standalone note for each category and associate all notes under that category to that note.

    Another option would be to use tags, but I would probably prefer not to pollute the tags with those rather long category names.
  • Zotero doesn't have directions for relations.

    On the other questions -- you can try to make that happen -- it's theoretically possible (though with the caveat of the broken relations import noted above) but it goes beyond what I can help with. Zotero is different from Citavi, and there's going to be some loss on transferring between different systems.
  • edited February 24, 2021
    Thanks for the clarifications. I might give this a try once the broken relations import is fixed. Since I have almost no programming knowledge (especially not in javascript), so I would need to start from code that works. Or do you understand which part of the code is broken?

    And if you can point me to some resources that might guide me when extending the code, that would be really great. To give an example of what I'm looking for: when I tried to understand what ZU.xpathText does, I couldn't really find a good answer (I'm sure it's out there somewhere and will eventually find it, but at this point I don't even know whether this is a generic javascript command or something specific to Zotero. So if there is some place I can start with these kinds of questions, let me know.
  • Here's the documentation for translators: https://www.zotero.org/support/dev/translators/coding
    all functions starting with Z and ZU (aliases for Zotero. and Zotero.Utilities) are Zotero specific.

    WRT relations, I'm fairly certain that's a general problem on Zotero import, nothing to do with this specific translator.
  • > relations, I'm fairly certain that's a general problem on Zotero import, nothing to do with this specific translator.

    So this is something that needs to be fixed in Zotero itself? Am I right in assuming that this wont happen in the near future?
  • I have no idea on the timeline, I'm hoping for @dstillman to chime in on this.
    This has also been reported in another context and he'd have to say how complex and what priority a fix is. If it's just a small bug, they'll likely fix it very quickly. If it's due to larger changes and a complex fix, it'll take time.
  • Workarround
    First thanks a lot for all people solving many of my problems here esp @adamsmith @dstillman @zuphilip and @haug . I ran into touble myself by evacuating my work related Citavi data to Zotero,
    Citavi 6 offers the option to save a Projekct in Citavi 5 xml format, which interestingly enough is in xml directly (and woudn't open in Citavi 5 at least when tried.) Trying to import into zotero also gave an error which I reported under: 1468382517.

    This Error can be avoided if one changes the Version info in the second line of the citavi xml export from 6.10.0.0 to 5.10.0.0. Obviously the Import checks for the version number and does not like the version 6.

    If you copy the Atachment files to the folder containing the .xml file it will also import at least most of the attached files. If you have Zotfile active it will take some additional time for it to rename and copy the attachments (at least as far as I could see)
    thanks once more I hope someone can need the workaround.
Sign In or Register to comment.