Reputation: 3282
is it possible to tell the xml::twig handle to to parse only non nested tags?
i.e for example is it possible with the below code to proccess tag1,tag2,tag3 under the same handler and treat tag4 on differnet handler or i need handler for every tag
<tags>
<start>
<tag1> a <\tag1>
<tag2> a <\tag2>
<tag3> a <\tag3>
<tag4 att=2>
<tag6> a <\tag6>
<tag7> a <\tag7>
<\tag4>
<\start>
<start>
...
<\start>
..
<\tags>
my $t = XML::Twig->new(
twig_handlers => { 'tag1 tag2 tag3' => \&handler1
'tag4' => \&handler2
});
I mean if its possible to differ between nested and non nested tag ?
Upvotes: 0
Views: 181
Reputation: 2490
I'm not sure if this is what you're looking for, but if you just want to use the same handler for different tags, you should be able to do this:
twig_handlers => {
'tag1' => \&handler1,
'tag2' => \&handler1,
'tag3' => \&handler1,
'tag4' => \&handler2
}
Upvotes: 1