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,$stat ename,$stationn ame,$station,%x mlHash) = @_;
print <<__XML
<?xml version="1.0"?>
<weather>
<station stationId ="$station" stationName="$s tationname" state="$state">
<observationTim e>$xmlHash{"obs ervationTime"}</observationTime >
<currentWeather >$xmlHash{"weat her"}</currentWeather>
<temprature>$xm lHash{"tempratu re"}</temprature>
<wind>$xmlHash{ "windMph"} mph from $xmlHash{"windD irection"}</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.
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,$stat ename,$stationn ame,$station,%x mlHash) = @_;
print <<__XML
<?xml version="1.0"?>
<weather>
<station stationId ="$station" stationName="$s tationname" state="$state">
<observationTim e>$xmlHash{"obs ervationTime"}</observationTime >
<currentWeather >$xmlHash{"weat her"}</currentWeather>
<temprature>$xm lHash{"tempratu re"}</temprature>
<wind>$xmlHash{ "windMph"} mph from $xmlHash{"windD irection"}</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.
Comment