Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by rbala (Acolyte)
on Sep 25, 2013 at 08:40 UTC ( #1055634=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re^4: Parse multiple xml tags with different names to an array
Download Code
Replies are listed 'Best First'.
Re^5: Parse multiple xml tags with different names to an array
by Anonymous Monk on Sep 25, 2013 at 08:44 UTC
    Yeah, make it into a hash, use XML::LibXML::Element methods, I linked the docs above
      Hi , I just tried with these methods , but could not figure out the exact method for getting hash. Can you please advise ? Thanks, Bala.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2015-07-31 15:49 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 (279 votes), past polls