Michael D Schleif <[EMAIL PROTECTED]> wrote:

: Recently, I have encountered some browser inconsistencies
: while moving on to CSS2 based web sites.  Several kind
: souls have suggested removing the following line from my
: resulting web pages:
: 
:     <?xml version="1.0" encoding="iso-8859-1"?>
: 
: In fact, when I edit a copy of my CGI generated web pages,
: the resulting page renders as expected, especially on IE6.

    Yes. IE6 will go into Quirks if the XML declaration is
present. This url has more details.

 http://www.hut.fi/u/hsivonen/doctype.html


: As near as I can tell, the <?xml> directive is *optional*,
: according to the XML standards. However, it appears to be
: mandatory in my version of CGI.pm.

    It is mandatory in my version also. Here is a snippet
from start_html().

1311    my(@result,$xml_dtd);
1312    if ($dtd) {
1313        if (defined(ref($dtd)) and (ref($dtd) eq 'ARRAY')) {
1314            $dtd = $DEFAULT_DTD unless $dtd->[0] =~ m|^-//|;
1315        } else {
1316            $dtd = $DEFAULT_DTD unless $dtd =~ m|^-//|;
1317        }
1318    } else {
1319        $dtd = $XHTML ? XHTML_DTD : $DEFAULT_DTD;
1320    }
1321
1322    $xml_dtd++ if ref($dtd) eq 'ARRAY' && $dtd->[0] =~ /\bXHTML\b/i;
1323    $xml_dtd++ if ref($dtd) eq '' && $dtd =~ /\bXHTML\b/i;
1324    push @result,q(<?xml version="1.0" encoding="utf-8"?>) if $xml_dtd; 
1325
1326    if (ref($dtd) && ref($dtd) eq 'ARRAY') {


    Commenting line 1324 stops the "<?xml" line being output.
Changing a module directly is rarely recommended, but you'll
probably want to make this change site-wide. Your line number
will probably be different than mine.

1322    $xml_dtd++ if ref($dtd) eq 'ARRAY' && $dtd->[0] =~ /\bXHTML\b/i;
1323    $xml_dtd++ if ref($dtd) eq '' && $dtd =~ /\bXHTML\b/i;
1324    # push @result,q(<?xml version="1.0" encoding="utf-8"?>) if
$xml_dtd; 
1325
1326    if (ref($dtd) && ref($dtd) eq 'ARRAY') {


    You'll need to edit again if the admin upgrades or
re-installs CGI.pm. If you can't get to the CGI.pm source
you could copy it locally and "use lib" to use CGI.pm.
I imagine you could also write a module that subclasses
CGI.pm or wraps it to remove the "<?xml" line.

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328




_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to