RE: XML::LibXML and comments

2018-09-11 Thread John Cortland Morgan
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

Re: XML::LibXML and comments

2018-09-10 Thread Lawrence Statton
> 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 > >

Re: XML::LibXML and comments

2018-09-10 Thread Andy Bach
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

XML::LibXML and comments

2018-09-10 Thread John Cortland Morgan
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