For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > October 2006 > New module XML::Traverse::ParseTree









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author New module XML::Traverse::ParseTree
Martin Busik

2006-10-23, 9:57 pm

Hello,
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','section
s');
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-...ParseTree-0.02/

Feedback will be appreciated.

Cheers,
Martin


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com