Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Parse multiple xml tags with different names to an array

by rbala (Acolyte)
on Sep 23, 2013 at 09:07 UTC ( #1055249=note: print w/ replies, xml ) Need Help??


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 (Pope) 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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2015-07-28 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (259 votes), past polls