my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($file); my $t = $doc->getDocumentElement; foreach my $node ($t->findnodes('TransactionList/Transaction/XML')) { my $xml = $node->firstChild; my $xc = XML::LibXML::XPathContext->new($xml); foreach (qw( summary histFile fooScore )) { $xc->registerNs($_,"urn:$_"); $node->setNamespace("urn:$_",$_,0); } my $path = '//fooResponse/info/fooTransaction/transactionDetail/histFile:transactionSummary/summary:PacManScore'; my @nodes = $xc->findnodes($path);