Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] Perl tie

Expand Messages
  • Charles K. Clarkson
    ... perldoc perltie or: http://www.perldoc.com/perl5.6.1/pod/perltie.html HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328
    Message 1 of 3 , May 26, 2004
    • 0 Attachment
      leegold <leegold@...> wrote:
      :
      : Will someone point me to a doc. on "tie".

      perldoc perltie or:

      http://www.perldoc.com/perl5.6.1/pod/perltie.html

      HTH,

      Charles K. Clarkson
      --
      Mobile Homes Specialist
      254 968-8328
    • vinay mysore
      Hi, i am trying to parse an xml file using XML::Parser,i am not able to view the parsed data on a browser(i can only see the header of the table). wen i run
      Message 2 of 3 , May 27, 2004
      • 0 Attachment
        Hi,
        i am trying to parse an xml file using XML::Parser,i
        am not able to
        view the parsed data on a browser(i can only see the
        header of the
        table). wen i run the same program on command line it
        works fine. can
        anybody help with this? here is the code:

        #!/perl/bin/perl
        use XML::Parser;
        $xp=new XML::Parser();
        $xp->setHandlers(Start=>\&start, End=>\&end, Char=>
        \&cdata);

        $currentTag = "";


        print "Content-Type: text/html\n\n";

        # set up HTML page
        print "<html><head></head><body>";
        print "<h2>The Digital Points</h2>";
        print "<table border=1 cellspacing=1 cellpadding=5>";
        print "<tr><td align=center>Point Number</td><td
        align=center>State</td><td
        align=center>WriteAddress ON</td><td
        align=center>WriteAddress
        OFF</td></tr>";
        $xp->parsefile("DO_RadioButtons.xml");
        print "</table></body></html>";

        sub start()
        {
        # extract variables
        my ($parser, $name, %attr) = @_;

        $currentTag = lc($name);

        if ($currentTag eq "point")
        {
        print "<tr>";
        }
        elsif ($currentTag eq "name")
        {
        print "<td>";
        }
        elsif ($currentTag eq "state")
        {
        print "<td>";
        }
        elsif ($currentTag eq "writeaddress_on")
        {
        print "<td>";
        }
        elsif ($currentTag eq "writeaddress_off")
        {
        print "<td>";
        }

        }


        sub end()
        {
        my ($parser, $name) = @_;
        $currentTag = lc($name);
        if ($currentTag eq "point")
        {
        print "</tr>";
        }
        elsif ($currentTag eq "name")
        {
        print "</td>";
        }
        elsif ($currentTag eq "state")
        {
        print "</td>";
        }
        elsif ($currentTag eq "writeaddress_on")
        {
        print "</td>";
        }
        elsif ($currentTag eq "writeaddress_off")
        {
        print "</td>";
        }
        $currentTag = "";
        }


        sub cdata()
        {
        my ($parser, $data) = @_;

        if ($currentTag eq "name")
        {
        print "<i>$data</i>";
        }
        elsif ($currentTag eq "state")
        {
        print $data;
        }
        elsif ($currentTag eq "writeaddress_on")
        {
        print "$data";
        }
        elsif ($currentTag eq "writeaddress_off")
        {
        print "$data";
        }

        }





        __________________________________
        Do you Yahoo!?
        Friends. Fun. Try the all-new Yahoo! Messenger.
        http://messenger.yahoo.com/
      Your message has been successfully submitted and would be delivered to recipients shortly.