Find the answer to your Linux question:
Results 1 to 8 of 8
I want to print my following xml syntax on web using perlCGI script print header; print start_html( "Info"); print "<xml>\n"; print "\t\t\t<numb-compobjs>$comp_objs</numb-compobjs>\n"; print "\t\t\t<num-noncompobjs>$ncomp_objs</numb-noncompobjs>\n"; print "\t\t\t<tot-numbobjs>$total_objs</tot-numbobjs>\n"; print "</xml>\n"; print end_html; ...
  1. #1
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114

    How to print XML tags on web using perlCGI???

    I want to print my following xml syntax on web using perlCGI script

    print header;
    print start_html( "Info");

    print "<xml>\n";
    print "\t\t\t<numb-compobjs>$comp_objs</numb-compobjs>\n";
    print "\t\t\t<num-noncompobjs>$ncomp_objs</numb-noncompobjs>\n";
    print "\t\t\t<tot-numbobjs>$total_objs</tot-numbobjs>\n";
    print "</xml>\n";

    print end_html;

    and its giving me error, please help how can I print

  2. #2
    Linux Newbie
    Join Date
    Jan 2008
    Location
    UK
    Posts
    211
    Hi, What error is it coming out with? any clues as to where it is failing?

  3. #3
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114
    Sorry its not printing the xml syntax on web(IExplorer)

    and when I am remvoing the

    print header;
    print start_html( "Info");

    getting following error:-

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator

  4. #4
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    The error code is 503 or something like that, right? That means there is an error in your script. The usual suggestion is to first run the script from the commandline to see if there are any errors.

    You need the header and start_html, because these give respectively the HTTP header (necessary for a browser to know what it should expect) and the <html> tag and <head> section of your page.

    What output do you get? Click View Source in your web browser and see what's there.
    DISTRO=Arch
    Registered Linux User #388732

  5. #5
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114
    Problem has been resolved.

    Problem was whr the html header.

    Due to html header I was not able to complile xml syntax on web
    So I used following and its working fine:-


    print "Content-type: text/xml\n\n";
    print "<?xml version=\"1.0\"?>\n";

    print "\t\t\t<numb-compobjs>$comp_objs</numb-compobjs>\n";
    print "\t\t\t<num-noncompobjs>$ncomp_objs</numb-noncompobjs>\n";
    print "\t\t\t<tot-numbobjs>$total_objs</tot-numbobjs>\n";

    print end_html;


    Thanks for all help and sugession, please keep helping me thank you so much.

  6. #6
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114
    Now I am facing another problem, its not printing my customize messages lieke print "Error: userName not exist" on web, how can resolve this issue????

  7. #7
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Where / how are you printing this message?
    DISTRO=Arch
    Registered Linux User #388732

  8. #8
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114
    These are simple print commands of perl earlier it was showing perfectly in web browser with html header but after using

    Content-type: text/xml

    in place of html header for desplaying the hardcoded xml tags in script these are not working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...