CGI newbie

Discussion in 'Perl Misc' started by El Durango, Jul 16, 2004.

  1. El Durango

    El Durango Guest

    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.
     
    El Durango, Jul 16, 2004
    #1
    1. Advertising

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


    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.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Jul 16, 2004
    #2
    1. Advertising

  3. El Durango

    El Durango Guest

    "Gunnar Hjalmarsson" <> wrote in message
    news:...
    > 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.

    >
    > 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.
    >
    > --
    > Gunnar Hjalmarsson
    > Email: http://www.gunnar.cc/cgi-bin/contact.pl


    I will try that but I am afraid they may point me back here.
    Anyway, thanks for the advice.
     
    El Durango, Jul 16, 2004
    #3
  4. > 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.
     
    Eugene Mikheyev, Jul 16, 2004
    #4
  5. El Durango

    krakle Guest

    "El Durango" <> wrote in message news:<%ZLJc.8990$>...
    > 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?
     
    krakle, Jul 16, 2004
    #5
  6. El Durango

    El Durango Guest

    "krakle" <> wrote in message
    news:...
    > "El Durango" <> wrote in message

    news:<%ZLJc.8990$>...

    Thanks for being the 3rd person to tell me this, I might have forgotten
    otherwise.
     
    El Durango, Jul 17, 2004
    #6
  7. Pinocchio <> wrote:


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



    Errr, yes. You are correct.

    The moon is blue.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jul 17, 2004
    #7
  8. El Durango

    Sam Holden Guest

    On Fri, 16 Jul 2004 23:50:16 GMT, El Durango <> wrote:
    >
    > "krakle" <> wrote in message
    > news:...
    >> "El Durango" <> wrote in message

    > news:<%ZLJc.8990$>...
    >
    > Thanks for being the 3rd person to tell me this, I might have forgotten
    > otherwise.


    Welcome to usenet message propogation.

    --
    Sam Holden
     
    Sam Holden, Jul 17, 2004
    #8
  9. Tad McClellan wrote:

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

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
     
    Sherm Pendley, Jul 17, 2004
    #9
  10. Sherm Pendley wrote:
    > 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)
     
    John W. Kennedy, Jul 19, 2004
    #10
  11. John W. Kennedy wrote:
    > Actually, that's largely incorrect. See
    > <URL:http://skyandtelescope.com/observing/objects/moon/article_127_1.asp>


    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%20moon>, 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--
     
    Sherm Pendley, Jul 19, 2004
    #11
  12. El Durango

    krakle Guest

    "El Durango" <> wrote in message news:<YQZJc.12033$>...
    > "krakle" <> wrote in message
    > news:...
    > > "El Durango" <> wrote in message

    > news:<%ZLJc.8990$>...
    >
    > 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. :)
     
    krakle, Jul 20, 2004
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jürgen Exner

    Re: CGI Perl "use CGI" statement fail

    Jürgen Exner, Jul 31, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,538
    Jürgen Exner
    Jul 31, 2003
  2. Shailan
    Replies:
    2
    Views:
    1,113
    Shailan
    Dec 15, 2003
  3. John Smith
    Replies:
    0
    Views:
    3,205
    John Smith
    May 15, 2006
  4. LarsenMTL
    Replies:
    4
    Views:
    816
    Eric Walstad
    Nov 4, 2004
  5. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    732
    Michael Sparks
    Jul 30, 2005
Loading...

Share This Page