New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MARCXML import breaks when a subfield is empty #1722

Closed
bencomp opened this Issue Aug 23, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@bencomp
Contributor

bencomp commented Aug 23, 2018

I see this error in the console when I look at a Code4Lib Journal article:

10:41:44.868 TypeError: sf is null at moz-extension://c83442f6-3b5a-c342-995b-817efcb1fc4d/inject/translate_inject.js line 63 > eval:67 zotero.js:297:4

Using the debug log I found that the Code4Lib Journal translator was broken (see #1721) and that Zotero tries to use the MARCXML translator on the unAPI MARCXML output. This output contains an empty (string in a) subfield: <marc:subfield code="a"></marc:subfield>, which I guess is the reason sf is null in:

translators/MARCXML.js

Lines 64 to 67 in 2d3e4bd

var sf = ZU.xpathText(subfields[k], "./text()", ns);
//delete non-sorting symbols
//e.g. &#152;Das&#156; Adam-Smith-Projekt
sf = sf.replace(/[\x80-\x9F]/g,"");

All other subfields contain text.

I don't know for sure if this is an error on the Code4Lib Journal side – empty tags don't add value, but I don't know if they are forbidden. Perhaps the translator should be aware of and resistent to empty subfield elements?

@adam3smith adam3smith self-assigned this Aug 24, 2018

@adam3smith

This comment has been minimized.

Show comment
Hide comment
@adam3smith

adam3smith Aug 24, 2018

Collaborator

yup, thanks, I have a fix for this, coming shortly

Collaborator

adam3smith commented Aug 24, 2018

yup, thanks, I have a fix for this, coming shortly

@adam3smith

This comment has been minimized.

Show comment
Hide comment
@adam3smith

adam3smith Aug 25, 2018

Collaborator

closed via e234d96

Collaborator

adam3smith commented Aug 25, 2018

closed via e234d96

@adam3smith adam3smith closed this Aug 25, 2018

@adam3smith

This comment has been minimized.

Show comment
Hide comment
@adam3smith

adam3smith Aug 25, 2018

Collaborator

FWIW, I do think this is an error by Code4Lib -- their MAiRCXML isn't all that good overall -- but I don't see any reason to not just skip empty subfields.

Collaborator

adam3smith commented Aug 25, 2018

FWIW, I do think this is an error by Code4Lib -- their MAiRCXML isn't all that good overall -- but I don't see any reason to not just skip empty subfields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment