Are you sure you want to parse and reparse the XML many times for each individual widget? I'd rather parse it just once at the beginning or at most once when the language is changed.
use XML::Rules; my $parser = XML::Rules->new(rules=>{ widget => 'content by ID', language => 'pass no content', _default => 'no content' }); my $data = $parser->parse(\*DATA); use Data::Dumper; print Dumper($data); # $data{english}{1} == "input" __DATA__ <?xml version="1.0"?> <language> <english> <widget ID="1">input</widget> <widget ID="2">output</widget> </english> <deutsch> <widget ID="1">eingabe</widget> <widget ID="2">ausgabe</widget> </deutsch> </language>
Jenda
Enoch was right!
Enjoy the last years of Rome.
In reply to Re: language selection via libxml
by Jenda
in thread language selection via libxml
by banzai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |