Re: Change to HTML::Parser made <!DOCTYPE> case-sensitive
Gisle Aas (gisle@activestate.com)
03 Dec 2000 20:58:33 -0800
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