##
use XML::Parser;
# initialize parser and read the file
$parser = new XML::Parser( Style => 'Tree' );
my $tree = $parser->parsefile( shift @ARGV );
# serialize the structure
use Data::Dumper;
print Dumper( $tree );
####
$VAR1 = [
'booklist',
[
{},
0,
'
',
'book',
[
{
'type' => 'technical'
},
0,
'
',
'author',
[
{},
0,
'Book 1 author 1'
],
0,
'
',
'author',
[
{},
0,
'Book 1 author 2'
],
0,
'
',
'title',
[
{},
0,
'Book 1 title'
],
0,
'
',
'isbn',
[
{},
0,
'Book1ISBN'
],
0,
'
'
],
0,
'
',
'book',
[
{
'type' => 'fiction'
},
0,
'
',
'author',
[
{},
0,
'Book 2 author 1'
],
0,
'
',
'author',
[
{},
0,
'Book 2 author 2'
],
0,
'
',
'title',
[
{},
0,
'Book 2 title'
],
0,
'
',
'isbn',
[
{},
0,
'Book2ISBN'
],
0,
'
'
],
0,
'
',
'book',
[
{
'type' => 'technical'
},
0,
'
',
'author',
[
{},
0,
'Book 3 author 1'
],
0,
'
',
'author',
[
{},
0,
'Book 3 author 2'
],
0,
'
',
'author',
[
{},
0,
'Book 3 author 3'
],
0,
'
',
'title',
[
{},
0,
'Book 3 title'
],
0,
'
',
'isbn',
[
{},
0,
'Book3ISBN'
],
0,
'
'
],
0,
'
'
]
];