problem displaying XML in browser using Cgi
"El Durango" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | SBC http://yahoo.sbc.com |
| Message-ID | <[email protected]> |
Hi I have a simple CGI program that takes data from a data source and posts
it
as XML format on the browser, I have tested my program on IE and Mozilla
and they behave differently. Sometimes XML format is displayed sometimes
just the data is displayed excluding the elements.
Here is a snippet of my code that displays the data:
sub displayInfo{
my($state,$statename,$stationname,$station,%xmlHash) = @_;
print <<__XML
<?xml version="1.0"?>
<weather>
<station stationId ="$station" stationName="$stationname" state="$state">
<observationTime>$xmlHash{"observationTime"}</observationTime>
<currentWeather>$xmlHash{"weather"}</currentWeather>
<temprature>$xmlHash{"temprature"}</temprature>
<wind>$xmlHash{"windMph"} mph from $xmlHash{"windDirection"}</wind>
</station>
</weather>
__XML
}
It seems that Mozilla is pretty strict on displaying the data in XML format.
For instance the following perl block:
print <<__ERROR
<?xml version="1.0"?>
<weather>
<meta>
<error>
Incompatible Data.
</error>
</meta>
</weather>
__ERROR
gets displayed as just:
Incompatible Data.
As if it were HTML.
If anyone has any ideas I would appreciate it.