Search
Tweets
Recent Changes
« Dancing In The Rain | Main | Halloween Peekchurs »
Wednesday
Nov092005

XML::DOM - The Declaration

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.

December 27, 2006 | Unregistered CommenterGreydad

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>