Quantcast
Channel: Parsing XML into hash with XML::Parser in Perl - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Parsing XML into hash with XML::Parser in Perl

$
0
0

I want to parse a simple XML document to hash.

<?xml version ="1.0"?><catalog><book id = "bk101"><author>Bob</author><title>Batman</title></book><book id = "bk102"><author>Jerry</author><title>Superman</title></book></catalog>

The expected output is something like the following.

$VAR1 = {'catalog'=>{'bk101'=>['author'=>'Bob','title'=>'Batman'                  ]'bk102'=>['author'=>'Jerry','title'=>'Superman'                  ]        }    }

I have done this with the help of XML::Simple and other libraries, but I have to do it with XML::Parser, without the use of recursion.

How would I do this in Perl?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images