Thanks, despite being marked "experimental" it does appear to work in the OP's case:
use warnings; use strict; use XML::LibXML::Reader; my $xml = <<'ENDXML'; <foo xmlns="http://www.example.com"><bar/></foo> ENDXML my $reader = XML::LibXML::Reader->new(string => $xml); while ($reader->read) { my $node = $reader->copyCurrentNode; $node->setNamespaceDeclURI(undef, undef) if $node->nodeName eq 'bar'; print "$node"; } __END__ <foo xmlns="http://www.example.com"/><bar/><foo xmlns="http://www.exam +ple.com"/>
Unfortunately I might still be missing something, because applied to choroba's code here it doesn't seem to change the namespace of the nodes.
In reply to Re^3: copyCurrentNode in XML::LibXML::Reader will add xmlns attribute ( setNamespaceDeclURI )
by haukex
in thread copyCurrentNode in XML::LibXML::Reader will add xmlns attribute
by mjfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |