The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Simple::SAX::Serializer::Element - XML node element.

SYNOPSIS

   my $xml = Simple::SAX::Serializer->new;
   $xml->handler('dataset', sub {
            my ($self, $element, $parent) = @_;
            my $attributes = $element->attributes;
            my $children_result = $element->children_result;
            {properties => $attributes, dataset => $children_result}
        }
    );
    $xml->handler('*', sub {
        my ($self, $element, $parent) = @_;
        my $attributes = $element->attributes;
        my $children_result = $parent->children_array_result;
        my $result = $parent->children_result;
        push @$children_result, $element->name => {%$attributes};
    });
}

DESCRIPTION

Represents xml node element.

EXPORT

None.

ATTRIBUTES

node

Stores reference to the xml node.

METHODS

attributes

Return attributes as hash ref.

name
children_result

Returns children results.

children_array_result

Returns children result as array ref

children_hash_result

Returns children result as hash ref

set_children_result

Sets children result

value

Return element's value. Takes optionally normalise spaces flag.

validate_attributes

Validates element attributes takes, required attributes parameter as array ref, optional attributes parameter as hash ref $element->validate_attributes(['name'], {type => 'text'});

COPYRIGHT AND LICENSE

The Simple::SAX::Serializer::Element module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

SEE ALSO

Simple::SAX::Serializer Simple::SAX::Serializer::Parser Simple::SAX::Handler

AUTHOR

Adrian Witas, adrian@webapp.strefa.pl

See also