in reply to Re: Parse multiple xml tags with different names to an array
in thread Parse multiple xml tags with different names to an array

Hi, Thank you, but I am unable to figure out my exact requirement from a huge pool of info there in "state of web spidering in perl". Can you specify exactly which matches my req ? Thanks, Bala.
  • Comment on Re^2: Parse multiple xml tags with different names to an array

Replies are listed 'Best First'.
Re^3: Parse multiple xml tags with different names to an array
by Corion (Patriarch) on Sep 23, 2013 at 09:10 UTC

    Personally, I would look at using XML::LibXML and XPath queries to retrieve the child nodes. XML::Twig is also a very similar and capable approach, especially if your XML documents do not fit into available memory.

Re^3: Parse multiple xml tags with different names to an array
by Anonymous Monk on Sep 23, 2013 at 09:44 UTC
      Thanks for ur comments :)
      Hi ,

      With all your help , I am able to get the child nodes as an array using the code below :

      my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($string); my @nodes = $doc->findnodes("//ROOT_TAG/*"); Is there any possible ways to do this ?

      The resultant array elements of @nodes are all XML::LibXML::Elements object. I need this to be hash for my processing. Is there any way to do this ?

      Thanks,

      Bala.

        Yeah, make it into a hash, use XML::LibXML::Element methods, I linked the docs above