Hi Lawrence,
Works great, thanks! Never thought of appending the comment directly to the
$doc, just assumed I
Needed to set the root first.
Regards,
John
From: Lawrence Statton
Sent: Monday, September 10, 2018 9:44 PM
To: beginners@perl.org
Subject: Re: XML::LibXML and comments
On Sep
> On Sep 10, 2018, at 6:33 AM, John Cortland Morgan
> wrote:
>
> Hi,
>
> I'm trying to place a comment directly after the XML declaration using
> XML::LibXML,
> But cannot seem to manage, always receiving error:
>
> setDocumentElement: ELEMENT node required at .../LibXML.pm line 1393
>
>
Take a look at:
https://stackoverflow.com/questions/19411152/libxml-inserting-a-comment
use XML::LibXML;
my $doc = XML::LibXML::Document->new;my $root = $doc->createElement("doc");
$doc->setDocumentElement($root);
$root->appendChild($doc->createElement("JJ"));
$root->appendChild($doc->createCommen
Hi,
I'm trying to place a comment directly after the XML declaration using
XML::LibXML,
But cannot seem to manage, always receiving error:
setDocumentElement: ELEMENT node required at .../LibXML.pm line 1393
What I would like:
testing
My relevant code thus far:
My $dom = XML::LibXML