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

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

serialize and export XML documents

## NAME

Catmandu::Exporter::XML - serialize and export XML documents

## DESCRIPTION

This Catmandu::Exporter exports items serialized as XML. Serialization is implemented based on XML::Struct::Writer::Stream. By default, each item is written to STDOUT.

## CONFIGURATION

- attributes

  - xmldecl

  - encoding

  - version

  - standalone

  - pretty

  These options are passed to XML::Struct::Writer. The target (option `"to"`) is based on Catmandu::Exporter's option `"fh"` or `"file"`.

- field

  Take XML from a given field of each item, e.g. field `"xml"` as following:

  ```
      { xml => [ root => { xmlns => 'http://example.org/' }, [ ... ] ] }
  ```

- directory

  Serialize to multiple files in a given directory.

- filename

  Field to take filenames from if option `"directory"` is set. Defaults to `"_id"`. The file extension `".xml"` is appended unless given.
