XML::Parser::Wrapper

0.15 Perl Artistic License    
2.3/5 21

description

download

specs

XML::Parser::Wrapper is a Perl module for parsing XML. XML::Parser::Wrapper is a wrapper on top of XML::Parser that provides a more friendly API.

SYNOPSIS

use XML::Parser::Wrapper;
my $xml = qq{Hello World!};
my $root = XML::Parser::Wrapper->new($xml);
my $root2 = XML::Parser::Wrapper->new({ file => '/tmp/test.xml' });
my $root_tag_name = $root->name;
my $roots_children = $root->elements;
foreach my $element (@$roots_children) {
if ($element->name eq 'head') {
my $id = $element->attr('id');
my $hello_world_text = $element->text; # eq "Hello World!"
}
}
my $head_element = $root->element('head2');
my $head_elements = $root->elements('head2');
my $test = $root->element('head2')->element('test_tag');
my $new_element = $root->add_child('test4', { attr1 => 'val1' });
my $kid = $root->update_kid('root_child', { attr2 => 'stuff2' }, 'blah');
$kid->update_node({ new_attr => 'new_stuff' });
$new_element->add_child('child', { myattr => 'stuff' }, 'bleh');
my $new_xml = $root->to_xml;
read more   
Last updated on April 25th, 2012

0 User reviews so far.

SUBMIT
XML::Parser::Wrapper is a Perl module for parsing XML.

  556 downloads

#Perl wrapper #XML parser #Perl module #XML #Perl #wrapper #parser