---
name: "Catmandu::Exporter::MARC::XML"
section: "3pm"
platform: "linux"
package: "libcatmandu-marc-perl"
version: "1.320-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Exporter::MARC::XML"
---

# Catmandu::Exporter::MARC::XML(3pm)

Exporter for MARC records to MARCXML

## NAME

Catmandu::Exporter::MARC::XML - Exporter for MARC records to MARCXML

## SYNOPSIS

```
    # From the command line
    $ catmandu convert MARC to MARC --type XML < /foo/data.mrc
    # From Perl
    use Catmandu;
    my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 'ISO');
    my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 'XML' );
    $exporter->add($importer);
    $exporter->commit;
```

## DESCRIPTION

This Catmandu::Exporter::MARC serializes MARC records as XML.

## CONFIGURATION

- file

  Write output to a local file given by its path or file handle. Alternatively a scalar reference can be passed to write to a string and a code reference can be used to write to a callback function.

- fh

  Write the output to an IO::Handle. If not specified, Catmandu::Util::io is used to create the output handle from the `"file"` argument or by using STDOUT.

- fix

  An ARRAY of one or more fixes or file scripts to be applied to exported items.

- record

  the key containing the marc record (default: 'record')

- record\_format

  Optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON

- collection

  add a marc:collection header when true (default: true)

- xml\_declaration

  add a xml declaration when true (default: true)

- skip\_empty\_subfields

  skip fields which don't contain any data (default: false)

- pretty

  pretty-print XML

## METHODS

See Catmandu::Exporter, Catmandu::Addable, Catmandu::Fixable, Catmandu::Counter, and Catmandu::Logger for a full list of methods.

## SEE ALSO

Catmandu::Importer::MARC::XML
