Catmandu::Importer::XML(3pm) | User Contributed Perl Documentation | Catmandu::Importer::XML(3pm) |
Catmandu::Importer::XML - Import serialized XML documents
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.
<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"] ] ] ] ] ]
{ attr => 'value', field1 => [ 'foo', 'bar' ], field2 => { doz => [ [ doz => { }, ["baz"] ] ] } }
This module is just a thin layer on top of XML::Struct::Reader. Have a look at XML::Struct to implement Importers and Exporters for more specific XML-based data formats.
2021-01-09 | perl v5.32.0 |