in reply to Re^2: copyCurrentNode in XML::LibXML::Reader will add xmlns attribute ( setNamespaceDeclURI )
in thread copyCurrentNode in XML::LibXML::Reader will add xmlns attribute
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: copyCurrentNode in XML::LibXML::Reader will add xmlns attribute ( setNamespaceDeclURI )
by choroba (Cardinal) on Sep 20, 2017 at 11:45 UTC | |
by beech (Parson) on Sep 20, 2017 at 18:18 UTC | |
by choroba (Cardinal) on Sep 30, 2017 at 09:59 UTC | |
by choroba (Cardinal) on Oct 01, 2017 at 20:09 UTC |