in reply to Re^2: How to modify an XML file using XML::DOM
in thread How to modify an XML file using XML::DOM

Hi ankit.tayal560,

You don't need the open and close - printToFile does all the handling of writing to the file for you.

As for the error message, it appears you've come across a bug - or at least a deficiency in the documentation - of XML::DOM. The document needs to have an "XMLDecl" set. You can do this for example via: $doc->setXMLDecl($doc->createXMLDecl('1.0','UTF-8'));

Hope this helps,
-- Hauke D

Replies are listed 'Best First'.
Re^4: How to modify an XML file using XML::DOM
by ankit.tayal560 (Beadle) on Sep 28, 2016 at 10:28 UTC

    thanks a lot . worked smoothly (Y)

Re^4: How to modify an XML file using XML::DOM
by ankit.tayal560 (Beadle) on Sep 28, 2016 at 08:12 UTC

    sorry but dint understood . I should copy this line of code into my script or into the XML::DOM documentation (i.e. DOM.pm)????

    $doc->setXMLDecl($doc->createXMLDecl('1.0','UTF-8'));