Skip to content
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

Processing file with no matching datasets leads to broken output #119

Open
FaMIbine opened this issue Jul 14, 2023 · 2 comments
Open

Processing file with no matching datasets leads to broken output #119

FaMIbine opened this issue Jul 14, 2023 · 2 comments

Comments

@FaMIbine
Copy link

While processing MARC-XML-files with a filter we notices that there seems to be a problem if no record from a file matches a filter or where returned at all. In this case we got a broken output: a closing xml-tag

You can reproduce the problem also with processing an empty XML file:

echo "<?xml version="1.0" encoding="UTF-8"?>
<collection xmlns="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
</collection>" | catmandu convert MARC --type XML to MARC --type XML

We filterted for example for MARC-field 924, which was not set in our file. So we expected to get an empty XML-file as output. Instead we got this output: "</marc:collection>"
The fix we used was the following:

marc_map(924,sigel,split:1)
select any_match(sigel.*,DE-1a)
marc_add(951,a,AR)

Our catmandu command was:
catmandu convert MARC --type XML to MARC --type XML --fix fixname.fix < filename.xml

We used Catmandu version 1.2020 on a Debian system.

Furthermore the MARC-ISO-Exporter delivers an incomplete MARC-dataset:

echo '{}' | catmandu convert JSON to MARC
00026     2200025   4500  
@phochste
Copy link
Member

Thank you for this bug report. The code has been fixed and version 1.31 is on its way to cpan.

@FaMIbine
Copy link
Author

Thank you so much for the bugfix and the fast response! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants