Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: XML processing

by shreya (Novice)
on Aug 10, 2005 at 22:31 UTC ( [id://482791]=note: print w/replies, xml ) Need Help??


in reply to Re: XML processing
in thread XML processing

Borisz,
I started using XML:Twig. However facing a problem.
my $twig = XML::Twig->new(twig_handlers => {a'=> \&Test ); # Parse the file $twig->parsefile($XmlFile); # Handler sub routine sub Test { my ($parser, $element) = @_; # This prints element <a> along with its contents to some out +put file $element->print(\*OP); # However What I really want done over here is have element <a> a +long with its subelements and text be copied to another variable inst +ead of being printed on screen }

Problem: What I really want done over here is have element along with its subelements and text be copied to another variable instead of being printed on screen

Something like

$ElementA .= $element->print;

Pls advice. Thanks,

Replies are listed 'Best First'.
Re^3: XML processing
by mirod (Canon) on Aug 10, 2005 at 23:13 UTC

    something like $ElementA .= $element->sprint;?

Re^3: XML processing
by shreya (Novice) on Aug 11, 2005 at 19:07 UTC
    Thanks Mirod. This worked. I am still trying to get used to this response method. Didnt realise that someone replied ot my old posts. Wish there was a way to notify by email when someone replies to your posts. Later
      In your User Settings you can turn on "msg me when there's a reply to one of my posts".

      (update: Of course, this post might be pointless if you don't check old posts)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found