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
In reply to Re^3: How to modify an XML file using XML::DOM
by haukex
in thread How to modify an XML file using XML::DOM
by ankit.tayal560
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |