Pkp-lib: Native citations import doesn't break citations string into single citations

Created on 12 Nov 2020  路  2Comments  路  Source: pkp/pkp-lib

See: https://forum.pkp.sfu.ca/t/doesnt-import-citations-from-xml/63837

Reported by 2 users, didn't reproduce this by myself.
According to the pkp-lib master branch code, NativeXmlPKPPublicationFilter::parseCitations doesn't insert line breaks between citations to be correctly tokenized by CitationListTokenizerFilter. See: https://github.com/pkp/pkp-lib/blob/d55739b90a9ac9460d0e1916946223c376ce4e4c/plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.inc.php#L247. I proposed a solution in the thread linked above for testing:

$citationsString = '';
foreach ($n->childNodes as $citNode) {
    $citationsString .= $citNode->textContent() . "\n";
}

Where line break is added after each citation, as it's expected by the tokenizer.

Bug

All 2 comments

PR to pkp-lib master: https://github.com/pkp/pkp-lib/pull/6333
@NateWr, can you take a look at this one? I'm not able to test it on master as encountered a problem importing XML through the plugin, suspect because of recent changes.

Thanks @Vitaliy-1! I tested by exporting then importing and this fixed it. :+1:

Was this page helpful?
0 / 5 - 0 ratings