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>";
In reply to Re: Print out an XML file to browser
by odrm
in thread Print out an XML file to browser
by lakeTrout
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |