Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > problem displaying XML on different browser

Reply
Thread Tools

problem displaying XML on different browser

 
 
El Durango
Guest
Posts: n/a
 
      07-16-2004
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,%xmlHas h) = @_;
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.



 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-16-2004


El Durango wrote:

> 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,%xmlHas h) = @_;
> 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.


Make sure your CGI sends the right HTTP response header
Content-Type: text/xml
before the markup.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
 
El Durango
Guest
Posts: n/a
 
      07-17-2004

"Martin Honnen" <(E-Mail Removed)> wrote in message
news:40f7f18b$(E-Mail Removed)...
>
> Make sure your CGI sends the right HTTP response header
> Content-Type: text/xml
> before the markup.
>


I have done that but my program still behaves differently on the 2 browsers.
Mozilla Firefox does not even want to show it in XML format.
Here is the piece of code that sets content-type:
print $web->header('Content-type' => 'text/xml');


 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      07-17-2004


El Durango wrote:
> "Martin Honnen" <(E-Mail Removed)> wrote
>
>>Make sure your CGI sends the right HTTP response header
>> Content-Type: text/xml
>>before the markup.
>>

>
> I have done that but my program still behaves differently on the 2 browsers.
> Mozilla Firefox does not even want to show it in XML format.
> Here is the piece of code that sets content-type:
> print $web->header('Content-type' => 'text/xml');


Is that online so that you could post a URL here that we can visit and
examine? Otherwise I can't help further I am afraid, if that is Perl
above you might want to ask in a Perl/CGI group.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
El Durango
Guest
Posts: n/a
 
      07-17-2004
You know what Martin, it has started to work all of sudden?
And I did not even touch it?? weird I must say.
I thank you for your time on this.

Danke!
Durango


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird issue, same code, same browser, two different apache servers,very different css bluebaron HTML 3 11-04-2009 07:13 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
different browser with different results Sean ASP .Net Web Services 3 05-18-2005 05:55 PM
Different aspect on different browser doGmaI HTML 18 04-24-2005 12:29 PM
Caching Different Xml files for different users Nita Raju ASP .Net 1 12-15-2004 07:10 AM



Advertisments