Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: XML::Rules Parsing Order

by Jenda (Abbot)
on Oct 13, 2015 at 11:30 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1144676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found