in reply to How to Parse XML output?

Hello powermonk, welocme to the Monastery.

Please, use <code> ... </code> tags not only for code samples, but for data as well.

There are several XML parsing modules on CPAN. I would recommend XML::LibXML. You can easily navigate in the XML document using XPath expressions:

#!/usr/bin/perl use warnings; use strict; use XML::LibXML; my $xml = XML::LibXML->load_xml(location => '1.xml'); my $v = $xml->findnodes('//Attribute[AttrName="ref_num"]/AttrValue') +; print "$v\n";
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: How to Parse XML output?
by powermonk (Initiate) on Mar 12, 2013 at 22:03 UTC
    Thanks for the quick response. can we pass a variable name in load_xml, since the o/p I get from a webservices call is stored in a variable whose contents are xml. Thank you.
      Have you read the documentation I linked to? The details are here: XML::LibXML::Parser - DOM Parser.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      can we pass a variable name in load_xml,

      No, programs are forbidden from using variables

      Sincerely yours, the great sarcasmo