Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^6: Apache +XML parsing

by Jenda (Abbot)
on Nov 18, 2008 at 15:21 UTC ( [id://724296]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Apache +XML parsing
in thread Apache +XML parsing

Thanks. I'll see if I can improve the docs. Especially regarding the "x-path-like" stuff. That thing is fairly underdocumented.

The code without using the "helper" would be

use XML::Rules; my $parser = XML::Rules->new( stripspaces => 7, rules => { fruit => 'as array', fruits => 'pass no content', 'average-color' => [ 'fruit' => sub {return 'fruit-average-color' => $_[1]->{_c +ontent}}, 'fruits' => sub {return 'global-average-color' => $_[1]->{ +_content}}, sub {}, ] } ); my $data = $parser->parse(\*DATA); use Data::Dumper; print Dumper($data); __DATA__ <fruits> <average-color>purple</average-color> <fruit type="banana"> <average-color>yellow</average-color> </fruit> <fruit type="apple"> <average-color>greenish</average-color> </fruit> </fruits>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found