++ed by:
TOBYINK SSCAFFIDI EGOR

3 PAUSE user(s)
1 non-PAUSE user(s).

Jakob Voß

NAME

XML::Struct::Simple - Transform MicroXML data structures into simple (unordered) form

VERSION

version 0.23

SYNOPSIS

    my $converter = XML::Struct::Simple->new( root => 'record' );
    my $struct = [ root => { xmlns => 'http://example.org/' }, 
                   [ '!', [ x => {}, [42] ] ] ];

    my $simple = $converter->transform( $xml );
    # { record => { xmlns => 'http://example.org/', x => 42 } }

DESCRIPTION

This module implements a transformation from structured XML (MicroXML) to simple key-value format as known from XML::Simple: Attributes and child elements are treated as hash keys with their content as value. Text elements without attributes are converted to text and empty elements without attributes are converted to empty hashes.

XML::Struct can export the function simpleXML for easy use.

CONFIGURATION

root

Keep the root element instead of removing. This corresponds to option KeepRoot in XML::Simple. In addition one can set the name of the root element if a non-numeric value is passed.

content

With option simple enable, text content at elements with attributes is parsed into a hash value with this key. Set to "content by default. Corresponds to option ContentKey in XML::Simple.

attributes

Assume input without attributes if set to a true value. The special value remove will first remove attributes, so the following three are equivalent:

    my @children = (['a'],['b']);

    simpleXML( [ $name => \@children ], attributes => 0 );
    simpleXML( removeXMLAttr( [ $name => \%attributes, \@children ] ), attributes => 0 );
    simpleXML( [ $name => \%attributes, \@children ], attributes => 'remove' );

Option KeyAttr, ForceArray, and other fetures of XML::Simple not supported (yet).

AUTHOR

Jakob Voß

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Jakob Voß.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.