in reply to XML processing

Seconding borisz's advice, here's some (untested) XML::Twig code to do this, in case you want to continue doing stuff with the results in perl:

use XML::Twig; # ... my $twig = XML::Twig->new(); $twig->parsefile($XmlFile); my @a_elements = $twig->get_xpath("//a"); foreach my $el (@a_elements) { my $text = $el->text(); # do stuff with $text. }
It's actually pretty easy, once you know which APIs you want ;-)

Update: Changed loop variable from $a to $el when reminded by graff. Tks.

Replies are listed 'Best First'.
Re^2: XML processing
by graff (Chancellor) on Aug 06, 2005 at 16:24 UTC
    But it would be better not to use "$a" as the name of the iterator variable in the "for" loop, in case "doing stuff" includes using "sort".
Re^2: XML processing
by shreya (Novice) on Aug 10, 2005 at 22:31 UTC

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

      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)