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?