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

# Catmandu::Fix::xml\_read(3pm)

parse XML to MicroXML

## NAME

Catmandu::Fix::xml\_read - parse XML to MicroXML

## SYNOPSIS

```
  # parse XML string given in field 'xml'
  xml_read(xml)
  xml_read(xml, simple: 1)
  xml_read(xml, attributes: 0)
```

## DESCRIPTION

This Catmandu::Fix parses XML strings into MicroXML or simple XML with XML::Struct.

## CONFIGURATION

Parsing can be configured with the following options of XML::Struct::Reader:

- attributes

  Include XML attributes (enabled by default)

- ns

  Define processing of XML namespaces (`"keep"` by default)

- whitespace

  Include ignorable whitespace as text elements (disabled by default)

- simple

  Convert to simple key-value structure, as known from XML::Simple

- root

  Keep (and possibly rename) root element when converting to `"simple"` form

- depth

  Only transform to a given depth with option `"simple"`

- path

  Parse only given elements (and all of its child elements) and return as array. For instance `"path => "p""` in an XHTML document would return a list of parsed paragraphs (`"<p>...</p>"`). This option overrides option `"root"`.

- content

  Name of text content when converting to `"simple"` form

## SEE ALSO

Catmandu::Fix::xml\_write, Catmandu::Fix::xml\_simple Catmandu::Fix::xml\_transform
