NAME

Simple::SAX::Serializer

DESCRIPTION

Represents xml serializer class,

SYNOPSIS

use Simple::SAX::Serializer;
my $xml = Simple::SAX::Serializer;

$xml->handler('root/child', sub {
    my ($self, $element, $parent) = @_;
    my $attributes = $element->attributes;
    my $result = $parent->children_array_result;
    push @$result,Child->new(%$attributes);
});

$xml->handler('root', sub {
    my ($self, $element) = @_;
      Root->new(%{$element->attributes}, children => $element->children_result);
});

my $xml_content = "<?xml version="1.0"?><root dummy="1"><child id="1" ><child id="2" ></root>";

$xml->parse_string($xml_content);
# or $xml->parse_file ...

ATTRIBUTES

handlers

METHODS

parse_sting

Runs the parser and returns result, xml as string

parse_file

Runs the parser and returns result, xml as file

parse

Runs the parser and returns result

find_handlder

Finds handler for current element. It start matching from root/element/searched_element and if not find that it try to resolve by element/searched_element and eventually searched_element If handler is not found then generates an error.

element_path

Takes array reference of the elements data structures, return list of element name.

COPYRIGHT

The Simple::SAX::Serializer 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::Parser XML::LibXML::SAX

AUTHOR

Adrian Witas, <adrian@webapp.strefa.pl</gt>

See also