Skip Menu |

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

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

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

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

Subject: adding a document fragment as a documentElement doesn't work
Download (untitled) / with headers
text/plain 365b
if I try adding a document-fragment to a document, I get a silent failure. It doesn't add the (only) child of the fragment, nor does it generate a warning. The pod for DocumentFragment suggests that you can use it anywhere you can insert a node, but if this is an intentional exception, a warning would be nice. I've attached minimal code to demonstrate the issue.
text/x-perl 326b
use XML::LibXML; my $frag = XML::LibXML::DocumentFragment->new; my $node = XML::LibXML::Element->new('foo'); $frag->appendChild($node); print $frag->toString, "\n"; my $doc = XML::LibXML::Document->new; $doc->setDocumentElement($frag); print $doc->toString, "\n"; $doc->setDocumentElement($node); print $doc->toString, "\n";
Download (untitled) / with headers
text/plain 156b
Fixed in the SVN (warning or croak issued at relevant places and documentation for setDocumentElement indicates clearly that fragments are not supported).

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

Please report any issues with to