CGI newbie

E

El Durango

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.
 
G

Gunnar Hjalmarsson

El said:
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.

Even if your CGI program is written in Perl, your problem seems not to
be a bit Perl related. Try a newsgroup that deals with HTML/XML.
 
E

El Durango

Gunnar Hjalmarsson said:
Even if your CGI program is written in Perl, your problem seems not to
be a bit Perl related. Try a newsgroup that deals with HTML/XML.

I will try that but I am afraid they may point me back here.
Anyway, thanks for the advice.
 
E

Eugene Mikheyev

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.

As Gunnar said, this is a wrong newsgroup for your problem.
It seems like you have no DTD for your XML file, and browsers use the
standard one, which is different in IE and Mozilla.
 
K

krakle

El Durango said:
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.

Are you kidding me????? This isn't even close to a Perl question. Isnt
this correct, Tad?
 
S

Sherm Pendley

Tad said:
The moon is blue.

Not for two weeks. A "blue moon" is the second full moon in a calendar
month, which will appear on the 31st of this month. It's not very common,
hence the expression once in a blue moon. The most recent one before this
was in Nov. '01.

sherm--
 
J

John W. Kennedy

Sherm said:
Not for two weeks. A "blue moon" is the second full moon in a calendar
month, which will appear on the 31st of this month. It's not very common,
hence the expression once in a blue moon. The most recent one before this
was in Nov. '01.

Actually, that's largely incorrect. See
<URL:http://skyandtelescope.com/observing/objects/moon/article_127_1.asp>

--
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the
obeisance of others! Thus is bad government born! Hold in your heart
that you and the people are one, human beings all, and good government
shall arise of its own accord! Such is the path of virtue!"
-- Kazuo Koike. "Lone Wolf and Cub: Thirteen Strings" (tr. Dana Lewis)
 
S

Sherm Pendley

John said:

The article you refer to does not call the newest meaning of the phrase
incorrect, it simply traces its origin.

According to the definition found The American Heritage Dictionary, as
found at <http://dictionary.reference.com/search?q=blue moon>, both
interpretations are valid:

blue moon
n.
1.
a. The second of two full moons occurring in the same month.
b. The third full moon in a three-month calendrical season
that has four full moons.
2. Informal. A relatively long period of time: I haven't seen
you in a blue moon.

sherm--
 
K

krakle

El Durango said:
Thanks for being the 3rd person to tell me this, I might have forgotten
otherwise.

You also may of forgotten that usenet isn't a chatroom and messages
don't appear instantly. Welcome to usenet. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,829
Latest member
KimberAlli

Latest Threads

Top