Wednesday
Nov092005
XML::DOM - The Declaration
Wednesday, November 9, 2005 at 3:13PM Took me a little while to find this today, so I thought I'd mention it for future reference.
To add a declaration to a document created with XML::DOM, do the following:
my $decl = $doc->createXMLDecl('1.0', 'UTF-8');
$doc->setXMLDecl($decl);
Now the xml from the toString() will have a declaration! If only I could find something that would indent the XML...

Reader Comments (1)
if you haven't found it yet, I use XML::Tidy to format XML into something humanly readable.