Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: XML::Rules Parsing Order

by Jenda (Abbot)
on Oct 13, 2015 at 11:30 UTC ( #1144676=note: print w/replies, xml ) Need Help??


in reply to XML::Rules Parsing Order

You can have both a "^parent_tag" and a "parent_tag" rule. The first will be called before the children (and may decide to skip the whole branch, but it only has access to the attributes), the second will be called after all children.

my %rules = ( _default => sub {$_[0] => trim($_[1]->{_content})}, '^parent_tag' => sub {...}, # called after parsing <parent_tag> parent_tag => sub {...}, # called after parsing </parent_tag> child_tag => sub {...}, # called after parsing </child_tag> )

Jenda
Enoch was right!
Enjoy the last years of Rome.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1144676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2021-02-28 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?