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

People
Owner: Nobody in particular
Requestors: martijn [...] cpan.org
Cc:
AdminCc:

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



Subject: adding a document fragment as a documentElement doesn't work
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.
Subject: bug.pl
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";
Fixed in the SVN (warning or croak issued at relevant places and documentation for setDocumentElement indicates clearly that fragments are not supported).