#!/usr/bin/perl use XML::XPath; use strict; use warnings; use Data::Dumper; my $file = 'F://Daten//scripte//bsp.xml'; my $xp = XML::XPath->new(filename=>$file); my $found_ab2=""; my $found_tobe=""; my $nodeset_ab2 = $xp->find('//ab2:prod0'); my $ab2_num_nodes = $nodeset_ab2->size; foreach my $node_ab2 ($nodeset_ab2->get_nodelist) { $found_ab2 = XML::XPath::XMLParser::as_string($node_ab2); } my $nodeset_ab3 = $xp->find('//ab3:prod0'); my $ab3_num_nodes = $nodeset_ab3->size; foreach my $node_ab3 ($nodeset_ab3->get_nodelist) { $found_ab3 = XML::XPath::XMLParser::as_string($node_ab3); } if ($found_ab2 eq $found_ab3) { print "ab2 und ab3 sind gleich\n"; } else { print "ab2 und ab3 sind NICHT gleich\n"; print "Found ab2:\n $found_ab2 \n"; print "\nFound ab3:\n $found_ab3 \n"; } print "Anzahl Nodes ab2: $ab2_num_nodes\n"; print "Anzahl Nodes ab3: $ab3_num_nodes\n";