Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 69520
Status: resolved
Priority: 0/
Queue: XML-LibXML

Owner: Nobody in particular
Requestors: yoreek [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: IDs of elements is lost when importing nodes
Download (untitled) / with headers
text/plain 267b
IDs of elements is lost when importing nodes from another document. When call method 'importNode' executed function 'xmlNodeCopy' from the library libxml2, which does not import IDs. Propose to replace the call "xmlNodeCopy" on "xmlDocNodeCopy" in the file "dom.c".
text/x-perl 452b
#!/usr/bin/perl use XML::LibXML; my $doc = XML::LibXML->load_xml(string => <<'EOT'); <root> <item xml:id="id1">item1</item> </root> EOT printf "id1: %s\n", $_ ? $_->textContent : 'not found' for $doc->getElementById('id1'); my $doc2 = XML::LibXML->createDocument( "1.0", "UTF-8" ); $doc2->setDocumentElement( $doc2->importNode( $doc->documentElement() ) ); printf "id1: %s\n", $_ ? $_->textContent : 'not found' for $doc2->getElementById('id1');
Subject: libxml.patch
Download libxml.patch
text/x-diff 482b
diff -Nura libxml-libxml-perl-1.70.ds/dom.c libxml-libxml-perl-1.70.ds.fixed/dom.c --- libxml-libxml-perl-1.70.ds/dom.c 2009-10-05 23:20:27.000000000 +0300 +++ libxml-libxml-perl-1.70.ds.fixed/dom.c 2011-07-16 13:55:27.188208417 +0300 @@ -580,7 +580,7 @@ return_node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node); } else { - return_node = xmlCopyNode( node, 1 ); + return_node = xmlDocCopyNode( node, doc, 1 ); } }
Download (untitled) / with headers
text/plain 135b
Thanks! This was fixed in XML-LibXML-1.81 which was just uploaded to CPAN. I added your patch and a t/*.t file based on your test case.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to