my $document = XML::LibXML->load_xml(location => 'Datei.xml'); my $xpc = XML::LibXML::XPathContext->new($document); $xpc->registerNs(ns => $document->documentElement->getAttribute('xmlns')); foreach my $ZN ($xpc->findnodes('//ns:Tag1/ns:Tag2')) { print $ZN->findvalue('/ns:Inhalt1'); }