compare_attr_list($attrs1, $attrs2, $nsup1, $nsup2) if (defined($attrs1));
compare_attr_list($attrs2, $attrs1, $nsup2, $nsup1) if (defined($attrs2));
+ # if this is a text node, check the contents
+ if ($n1->getNodeType == XML::DOM::TEXT_NODE) {
+ my $d1 = $n1->getData;
+ my $d2 = $n2->getData;
+
+ # ignore leading/trailing whitespace
+ $d1 =~ s/^\s+//;
+ $d2 =~ s/^\s+//;
+ $d1 =~ s/\s+$//;
+ $d2 =~ s/\s+$//;
+
+ # compress other whitespace
+ $d1 =~ s/\n/ /g;
+ $d1 =~ s/ +/ /g;
+ $d2 =~ s/\n/ /g;
+ $d2 =~ s/ +/ /g;
+
+ if ($d1 ne $d2) {
+ print STDERR "$nsuri1/$lname1 has differing textual content ('$d1' vs. '$d2')\n";
+ exit(1);
+ }
+ }
+
# this element is ok, let's compare all children
my $c1 = $n1->getChildNodes;
my $c2 = $n2->getChildNodes;
if ($c1->getLength != $c2->getLength) {
print STDERR "$nsuri1/$lname1 has differing number of children\n";
+ exit(1);
}
for my $i (0..($c1->getLength-1)) {