[Html-widget] Formatting of $result.as_xml
Jason Kohles
email at jasonkohles.com
Wed Oct 4 16:49:44 CEST 2006
On Oct 3, 2006, at 12:38 PM, Zbigniew Lukasiak wrote:
> I found it utterly difficult to deal with the output of
> $result.as_xml when debugging. Wouldn't it be usefull if there was
> an option to set some nice formatting there?
>
I do it like this...
if ( $ENV{ 'DEBUG_PRETTY_XML'} ) {
require XML::LibXML;
}
sub pretty_xml {
my ( $xml ) = @_;
return $xml unless $ENV{ 'DEBUG_PRETTY_XML' };
my $printer = XML::LibXML->new;
return "\n\n".$printer->parse_string( $xml )->toString( 1 )."\n\n";
}
You could probably even graft this into HTML::Widget, although I use
it for dealing with other kinds of xml too, so I like to keep it
separate.
--
Jason Kohles
email at jasonkohles.com
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/html-widget/attachments/20061004/b5646137/attachment.htm
More information about the Html-widget
mailing list