New module XML::Traverse::ParseTree
am 23.10.2006 23:57:35 von Martin BusikHello,
I'm happy to announce a new module XML::Traverse::ParseTree (v 0.02)
This module aims to simplify the access to the contents of a xml
document. When DOM-approach is the one and a SAX-parser-approach
the other extreme, then XML::Traverse::ParseTree strikes a balance between
them.
Parsing has to be done by means of XML::Parser, XML::Traverse::ParseTree
delivers getters and iterators. Access paths are specified in a xpath-like
syntax.
E.g.:
my $xml = XML::Parser->new(Style => "Tree")->parse($xmlcont);
my $h = XML::Traverse::ParseTree->new();
my $a1 = $h->get($xml,'document','structure','sections');
my $i = $h->get($a1,'section[*]','item[*]');
while (my $e = $i->()) {
...
$attr = $h->get($e,'another-child-element','@attribute-name');
$text = $h->get($e,'#TEXT');
}
You can download this package from CPAN:
http://search.cpan.org/~mbusik/XML-Traverse-ParseTree-0.02/
Feedback will be appreciated.
Cheers,
Martin