Hi all
just a quick question. I've been taking a look at the XML:arser module, its been a while since i did!
The subs style option seems intresting, when the parser hits an xml tag for example <bookname> it calls a sub routine you define as bookname.
If i were to implement this, is there any way to get the value of the <bookname> tag?
I've tried:
the xml is
anyknow how to grab 'Harry Potter' from inside the subroutine?
thanks
andy
just a quick question. I've been taking a look at the XML:arser module, its been a while since i did!
The subs style option seems intresting, when the parser hits an xml tag for example <bookname> it calls a sub routine you define as bookname.
If i were to implement this, is there any way to get the value of the <bookname> tag?
I've tried:
Code:
use XML::Parser;
my $p = XML::Parser->new(Style => 'Subs', Pkg => 'MySubs');
$p->parsefile('test.xml');
{
package MySubs;
sub bookname {
print "start of bookname tag\n";
print "$_\n";
}
sub bookname_ {
print "end of bookname\n";
}
}
the xml is
Code:
<book>
<bookname>Harry Potter</bookname>
</book>
anyknow how to grab 'Harry Potter' from inside the subroutine?
thanks
andy