XML::LibXML::DocumentFragment
Tom Metro <[email protected]> Wed, 16 Feb 2011 15:07:17 -0500
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
I have a need to generate some XML document fragments, which will be
rendered to strings, and then aggregated to a full document elsewhere.
My initial thought was to use XML::LibXML::DocumentFragment, but
unexpectedly it doesn't appear to support the same methods (such as
createElement()) as XML::LibXML::Document. (At least not in XML::LibXML
v.1.65.)
I see in the source that XML::LibXML::DocumentFragment subclasses
XML::LibXML::Node, rather than XML::LibXML::Document, as I'd expect. I
figured it would be a simple subclass of XML::LibXML::Document with one
overridden method, like:
sub toString {
my $self = shift;
local $XML::LibXML::skipXMLDeclaration = 1;
return $self->SUPER::toString(@_);
}
Easy enough to create my own subclass that does this, if that's what it
takes, but I'm curious to understand why XML::LibXML::DocumentFragment
isn't as expected, and what the recommended approach is for creating
document fragments.
-Tom
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs