I am trying to display an XML content (which is a SOAP request) in a simple HTML table using CGI Perl. However, the XML content is getting truncated inside the table cell. Can anybody suggest a solution to render the XML properly in the HTML page?
Below is the code :
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $qry = new CGI;
&show_html();
sub show_html {
$qry->header();
$qry->start_html(-bgcolor=>'#FFFFFF', -title=>'Rendering XML');
my $body = &display_page();
print $body;
$qry->end_html;
}
sub display_page {
my $html = qq{
<table border="1">
<tr>
<th> Key </th>
<th>Value</th>
</tr>
<tr>
<td> SOAP </td>
<td>POST /Quotation HTTP/1.0 Host: www.demohost Content-Type: text/xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.demourl1/2001/12/soap-envelope" SOAP-ENV:encodingStyle="http://www.demourl2/2001/12/soap-encoding" > <SOAP-ENV:Body xmlns:m="http://www.demourl3/quotations" > <m:GetQuotation> <m:QuotationsName>MiscroSoft</m:QuotationsName> </m:GetQuotation> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
</td>
</tr>
</table>
};
return $html;
}
&when calling Perl subroutines. That hasn't been correct since Perl v5.5 was released seventeen years ago