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)