in reply to XML processing help!
This is not a very well designed XML! And there's a missing / in the last tag.
use strict; use XML::Rules; my $parser = XML::Rules->new( stripspaces => 7, rules => { _default => 'as is', name => 'content', command => 'content', value => sub { my ($tag,$attr,$context,$parents) = @_; my $name = $parents->[-1]{name}; my $value = $attr->{_content}; return '%values' => {$name => $value}; } } ); my $data = $parser->parse(\*DATA); use Data::Dumper; print Dumper($data); __DATA__ <test_config> <action_1> <command>cmd</command> ...
Take this as the start and DO READ THE DOCS.
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|