sub _cmpXML( $$ ){ # Pass in two XML nodes and return 0 if they are the same, else # lexographically compare the namespaces fist then the node names # (with out prefexes) my $n1 = shift or die; my $n2 = shift or die; my $ns1 = $n1->namespaceURI(); my $ns2 = $n2->namespaceURI(); $ns1 ne $ns2 and return $ns1 cmp $ns2; my $nn1 = $n1->nodeName(); my $nn2 = $n2->nodeName(); $nn1 =~ s/^[^\:]*:?//; $nn2 =~ s/^[^\:]*:?//; return $nn1 cmp $nn2; }