How can I modify the script importing a XML file
In an earlier query I posted (https://forums.zotero.org/discussion/93336/importing-via-xml-additional-strange-behaviour) it was suggested that I could modify the script for importing a XML file but I cannot find what I should modify and it would be great to receive some pointers.
The issue I've been experiencing is: I have created a XML file (from Reference Manager) and, so far as I can tell, all the non-empty fields of each record are saved as expected. However, when I import into Zotero I find that two fields are not imported. These are tagged 'User Def 2' and 'User Def 3' in Reference Manager and from the behaviour of the other 'User Def ?' fields I would have expected them to end up tagged as 'custom2' and custom3' in the 'The following values have no corresponding Zotero field' Note in Zotero. The 'User Def 1/4/5' fields are imported and tagged 'custom1/4/5' in this Note field along with some other bits and bobs.
Many thanks for any assistance,
Anthony
The issue I've been experiencing is: I have created a XML file (from Reference Manager) and, so far as I can tell, all the non-empty fields of each record are saved as expected. However, when I import into Zotero I find that two fields are not imported. These are tagged 'User Def 2' and 'User Def 3' in Reference Manager and from the behaviour of the other 'User Def ?' fields I would have expected them to end up tagged as 'custom2' and custom3' in the 'The following values have no corresponding Zotero field' Note in Zotero. The 'User Def 1/4/5' fields are imported and tagged 'custom1/4/5' in this Note field along with some other bits and bobs.
Many thanks for any assistance,
Anthony
What you would need to modify is the EndnoteXML.js file in the translators folder in the Zotero data folder, but that should indeed just add custom2, custom3 etc to a note if they exist
-
User Def 1 field
-
User Def 2 field
-
User Def 3 field
-
User Def 4 field
-
User Def 5 field
I'll take a look at the EndnoteXML.js in a jiffy.
Many thanks,
Anthony
Here's the XML I tried to insert earlier.
<custom1>
<style font="default" face="normal">User Def 1 field</style>
</custom1>
<custom2>
<style font="default" face="normal">User Def 2 field</style>
</custom2>
<custom3>
<style font="default" face="normal">User Def 3 field</style>
</custom3>
<custom4>
<style font="default" face="normal">User Def 4 field</style>
</custom4>
<custom5>
<style font="default" face="normal">User Def 5 field</style>
</custom5>
I've had a look at the EndnoteXML.js file and it's going to take me a while to figure out what's going on... but as I don't really understand JavaScript that's a long shot. It's strange that some of these fields are imported (although put into a Child Note) while some aren't and the text is lost.
Thanks for the comments so far,
Anthony
Many thanks for your assistance with this.
} else if (field.search(/custom[237]/) != -1 &&
(newItem.itemType == "book" || newItem.itemType == "bookSection" || newItem.itemType == "journalArticle") &&
node.textContent.search(/PMC\d+/i) != -1) {
//it'd be nice if we could do PMIDs as well, but doesn't look like they're mapped and we can't test for them reliably
newItem.extra = (newItem.extra || '') +
"PMCID: " + node.textContent.match(/PMC\d+/i)[0] + "\n";
(make sure you get the closing & opening {} right.
By means of explanation, we've seen PMCID in those fields, which we want to import, but the test currently leads them to be ignored, which is a bug
I'm now going to do some larger scale tests before moving on to a 'final' import and I'm looking forward to being able to use Zotero as my sole bibliographic manager. Glad I was able to find a bug ;-{} .
Take care and thanks again.