473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

problem displaying XML on different browser

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.

Jul 20 '05 #1
4 1612


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/

Jul 20 '05 #2

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:40********@olaf.komtel.net...

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');
Jul 20 '05 #3


El Durango wrote:
"Martin Honnen" <ma*******@yahoo.de> 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/

Jul 20 '05 #4
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
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: vtreddy | last post by:
Hi All: In my application I am sending the input values through query string from a datagrid template column,I used URLEncode to encode the URL String, please find the input below, I am facing a...
6
by: Coleen | last post by:
Hi all :-) I need to redirect to multiple pages on click of a transmit button, without redisplaying each page. This redirection is to capture session variables that are created on each page and...
2
by: Godot | last post by:
I have an ASP.NET 1.1 web app that stores a current record ID value in a session variable so it can be accessed from multiple pages for inserting/updating of related records. Unfortunately, if...
13
by: David W. Fenton | last post by:
I've been struggling the last two days with something I thought was very easy, which is to open a web page with a form on it and populate the form with data passed in a query string (either POST or...
14
by: Brad | last post by:
I have a .net 2.0 web application project that creates a pdf file, saves the pdf to disk (crystal reports does this part), and then my code reads the pdf file and writes it to the httpresponse ...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
1
by: Maanav Jackson | last post by:
Hi I am displaying a third party webpage into a variable using curl library. When i am displaying the variable in the browser using echo command as shown below. echo $pagecopy; Browser is...
8
by: LayneMitch via WebmasterKB.com | last post by:
I'm supposed to develop a page that asks info as form values and when you hit "submit" it takes you to a page that reads the values you entered into the first page and displays those values in a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.