use warnings; use 5.010; use XML::Simple; use XML::MyXML; use XML::Twig; use XML::Parser; my $parser = new XML::Parser; $parser->setHandlers(Start => \&startElement, End => \&endElement,); $parser->parsefile('D:\\ABC\\Perl Projects\\DCA.xml'); sub startElement { my( $parseinst, $element, %attrs ) = @_; SWITCH: { if ($element eq "testcase") { $count++; $tag = "testcase"; print "Testcase $count:\n"; last SWITCH; } if ($element eq "step") { print "Step: "; $tag = "step"; last SWITCH; } if (%attrs eq "command") { print "Command: "; $tag = "Command"; last SWITCH; } } } sub endElement { my( $parseinst, $element ) = @_; if ($element eq "testcase") { print "\n\n"; } elsif ($element eq "title") { print "\n"; } }