in reply to Print out an XML file to browser
Here are two options:
use CGI qw(:cgi); # don't need HTML, only cgi stuff print header(-type => 'application/xml'); # make browser expect xml open XML, '<', 'foo.xml' or die $!; print while <XML>;
use CGI qw(:standard); sub escape_xml ($) { my $text = shift; $text =~ s/</</g; $text =~ s/<>/>/g; return $text; } print header, start_html('XML File'); open XML, '<', 'foo.xml' or die $!; print "<pre>\n"; print escape_xml($_) while <XML>; print "\n</pre>";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Print out an XML file to browser
by lakeTrout (Scribe) on Feb 20, 2007 at 19:26 UTC | |
Re: Print out an XML file to browser
by benizi (Hermit) on Feb 20, 2007 at 21:13 UTC | |
by odrm (Novice) on Mar 23, 2007 at 14:31 UTC |