Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: problem using XML Twig

by mirod (Canon)
on Sep 29, 2004 at 13:24 UTC ( #394962=note: print w/replies, xml ) Need Help??


in reply to problem using XML Twig

You could place your handler at dl level. Note that in this case the pretty_print do not work properly. The code looks a little simpler though:

#!/usr/bin/perl -w use strict; use XML::Twig; XML::Twig->new( twig_roots => { dl => sub { $_->subs_text( qr/(.+?)\s+ +(.+?)\n/, '&elt(first + => $1)&elt( second => $2)' ) ->print; }, }, twig_print_outside_roots => 1, ) ->parse( \*DATA); __DATA__ <c> <dl> ABC CDE add eerwe sdfsdfs erewrwe </dl> </c>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://394962]
help
Chatterbox?
[MidLifeXis]: Project Admin, a while ago: "No, I would prefer you didn't close that ticket yet confirming $vendor's support process yet. Continue to periodically check back to see if it has changed."...
[MidLifeXis]: Project Admin, today, after many periodic updates from me: "Why hasn't this been closed yet? Is there anything I can do to get this closed?" <facepalm>

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-01-19 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.