dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Getting Error: malformed header from script. Bad header=<?xml version="1.0" ??

  1. #1
    Join Date
    Mar 2008
    Posts
    2

    Getting Error: malformed header from script. Bad header=<?xml version="1.0" ??

    I am creating a CGI script to display data dynamically in XML format on Internet Explorer, following is my code:-

    use strict;
    use CGI ':standard';
    use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
    use XML::Simple();
    use XML::Writer;

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

    my $writer = new XML::Writer();
    $writer->xmlDecl();
    $writer->startTag('html');
    $writer->startTag('body');

    foreach my $ver (keys (%data_hash)) {
    $writer->startTag($ver);
    $writer->characters($data_hash{$ver});
    $writer->endTag($ver);
    }
    $writer->endTag('html');
    $writer->endTag('body');

    but I am getting following error message:-

    malformed header from script. Bad header=<?xml version="1.0" encoding=":

    Can anyone help me in resolving this issue.
    __________________

  2. #2
    Join Date
    Jul 2008
    Posts
    1
    I am facing the same problem with ActivePerl 5.10.0 XML::Writer 0.603 and apache 2.2? Any good luck to come around the problem....

  3. #3
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Looks like it isn't recognising the end of the headers. You might try \r\n\r\n instead of \n\n

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles