Skip to content

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

Open
@FaMIbine

Description

@FaMIbine

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  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions