Catmandu::Importer::XML(3pm)

Catmandu::Importer::XML3pm

Import serialized xml documents

Overview

This Catmandu::Importer reads XML and transforms it into a data structure.

See Catmandu::Importer, Catmandu::Iterable, Catmandu::Logger and Catmandu::Fixable for methods and options derived from these modules.

The importer can also be used internally for custom importers that need to parse XML data.

Configuration

type

By default (type ""simple""), elements and attributes and converted to keys in a key-value structure. For instance this document:

    <doc attr="value">
      <field1>foo</field1>
      <field1>bar</field1>
      <bar>
        <doz>baz</doz>
      </bar>
    </doc>

is imported as

    {
        attr => 'value',
        field1 => [ 'foo', 'bar' ],
        field2 => { 'doz' => 'baz' },
    }

With type ""ordered"" elements are preserved in the order of their appereance. For instance the sample document above is imported as:

    [ 
        doc => { attr => "value" }, [
            [ field1 => { }, ["foo"] ],
            [ field1 => { },  ["bar"] ],
            [ field2 => { }, [ [ doz => { }, ["baz"] ] ] ]
        ]
    ]
depth

Maximum depth for type ""simple"". For instance with depth 1, the sample document above would be imported as:

    {
        attr => 'value',
        field1 => [ 'foo', 'bar' ],
        field2 => { 
            doz => [ [ doz => { }, ["baz"] ] ]
        }
    }
attributes

Include XML attributes. Enabled by default.

path

Path expression to select XML elements. If not set the root element is selected.

root

Include root element name for type "simple". Disabled by default. The option is ignored if type is not "simple" or if a "path" has explicitly been set.

ns

Set to "strip" for stripping namespace prefixes and xmlns-attributes.

whitespace

Include ignoreable whitespace. Disabled by default.

xslt

Optional (list of) XSLT stylesheets to process records with Catmandu::XML::Transformer.

transform

Deprecated alias for option "xslt".

Releases

4 releases since Debian 10 (Buster); the text changed 2 times.

  1. 10
  2. 11
  3. 12–13

From libcatmandu-xml-perl 0.17-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.