use XML::LibXML; use strict; use warnings; my $parser = new XML::LibXML; my $xmlp= $parser -> parse_file("ko00010.xml"); my $rootel = $xmlp -> getDocumentElement(); my $elname = $rootel -> getName(); my @rootelements=$rootel -> getAttributes(); foreach my $rootatt(@rootelements){ my $name = $rootatt -> getName(); my $value = $rootatt -> getValue(); print " ${name}[$value]\n "; } my @kids = $rootel -> childNodes(); foreach my $child(@kids) { my $elname = $child -> getName(); my @atts = $child -> getAttributes(); foreach my $at (@atts) { my $name = $at -> getName(); my $value = $at -> getValue(); print " ${name}[$value]\n "; } }