Then build the ruleset in the script, something like:
and called asuse XML::Rules; @ARGV == 5 or die "Usage: BookStore3.pl roottag datatag idtag fitertag + filtervalue\n"; my ( $roottag, $datatag, $idtag, $fitertag, $filtervalue) = @ARGV; my $parser = XML::Rules->new( rules => [ _default => 'content', $datatag => sub { return unless $_[1]->{$fitertag} eq $_[4]->{parameters}; my $id = delete $_[1]->{$idtag}; delete $_[1]->{'_content'}; return $id => $_[1] }, $roottag => 'pass no content', ] ); my $data = $parser->parse(\*DATA, $filtervalue); use Data::Dumper; print Dumper( $data); __DATA__ <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore>
BookStore3.pl bookstore book title category CHILDREN
In reply to Re^3: Twig / Simple / xmlgrep --help
by Jenda
in thread Twig / Simple / xmlgrep --help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |