in reply to Re: Comparing nodes in LibXML
in thread Comparing nodes in LibXML

my $nn1 = $c1->localname(); my $nn2 = $c2->localname(); print "\$nn1 $nn1\n\$nn2 $nn2\n\n"; Output: $nn1 Authors $nn2 Authors

Replies are listed 'Best First'.
Re^3: Comparing nodes in LibXML
by worik (Sexton) on Sep 03, 2015 at 02:56 UTC

    localname is helpful. I missed it in the documentation. But it is only half the picture as it strips namespace information. Evven though it seems that namespaces are an abomination in XML I need to account for them. I am not generating the XML I have to eat.

      You can get the prefix at the same time
      my ($prefix,$name) = ( $node->prefix(), $node->localname() );

        The prefix does not help as it is not unique