develooper Front page | perl.libwww | Postings from December 2000

Re: Change to HTML::Parser made <!DOCTYPE> case-sensitive

Thread Previous
From:
Gisle Aas
Date:
December 3, 2000 20:59
Subject:
Re: Change to HTML::Parser made <!DOCTYPE> case-sensitive
Message ID:
lrzoic4wau.fsf@caliper.ActiveState.com
Liam Quinn <liam@htmlhelp.com> writes:

> A recent change (looks like 3.07 from the changelog) to HTML::Parser has
> made <!DOCTYPE> case-sensitive, but I don't think this should be the
> case (nsgmls is happy with either <!DOCTYPE> or <!doctype>).
> 
> I tested the following program with HTML::Parser 3.05 and 3.13:
> 
> #!/usr/bin/perl -w
> 
> use HTTP::Headers;
> use HTML::HeadParser;
> 
> $h = HTTP::Headers->new;
> $p = HTML::HeadParser->new($h);
> $p->parse(<<EOT);
> <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <TITLE>Foo</TITLE>
> <BASE HREF="http://www.example.com/">
> </HEAD><BODY>
> <H1>Foo</H1>
> EOT
> undef $p;
> print $h->header('Content-Base') . "\n";
> 
> 
> With HTML::Parser 3.05, the Content-Base is reported as
> "http://www.example.com/".  With 3.13, the Content-Base is undefined. 
> Changing <!doctype ...> to <!DOCTYPE ...> gives the desired Content-Base
> under both 3.05 and 3.13.

HTML-Parser-3.14 will parse <!doctype ...> as a declaration.  In
xml_mode the uppercase version is still needed.

Regards,
Gisle

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About