diff options
author | ot <ot@localhost> | 2007-03-22 14:17:12 +0000 |
---|---|---|
committer | ot <ot@localhost> | 2007-03-22 14:17:12 +0000 |
commit | 7124a8207d495761a6bd565a28dd66dd2a3d2bf4 (patch) | |
tree | 559542efdc2e6ccc260119187281c02d50987d0f | |
parent | 56e609a07ff07d8f947403ba133dba7e4241ef27 (diff) | |
download | markup-validator-7124a8207d495761a6bd565a28dd66dd2a3d2bf4.zip markup-validator-7124a8207d495761a6bd565a28dd66dd2a3d2bf4.tar.gz markup-validator-7124a8207d495761a6bd565a28dd66dd2a3d2bf4.tar.bz2 |
during pre-parsing to figure out the doctype, only use preparser in xml mode
if content-type is non-ambiguous. For text/html, assume sgml mode until
and XHTML doctype has been found.
see also http://www.w3.org/Bugs/Public/show_bug.cgi?id=978
-rwxr-xr-x | httpd/cgi-bin/check | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index d9d3fef..1eca97c 100755 --- a/httpd/cgi-bin/check +++ b/httpd/cgi-bin/check @@ -14,7 +14,7 @@ # This source code is available under the license at: # http://www.w3.org/Consortium/Legal/copyright-software # -# $Id: check,v 1.485 2007-03-19 01:51:21 ot Exp $ +# $Id: check,v 1.486 2007-03-22 14:17:12 ot Exp $ # # Disable buffering on STDOUT! @@ -180,7 +180,7 @@ Directory not readable (permission denied): @_r # # Strings - $VERSION = q$Revision: 1.485 $; + $VERSION = q$Revision: 1.486 $; $VERSION =~ s/Revision: ([\d\.]+) /$1/; # @@ -1667,8 +1667,12 @@ sub preparse_doctype { if ($attr->{xmlns}) {$File->{Namespace} = $attr->{xmlns}}; }; + # we use HTML::Parser as pre-parser. May use html5lib or other in the future my $p = HTML::Parser->new(api_version => 3); - $p->xml_mode(TRUE); + + # if content-type has shown we should pre-parse with XML mode, use that + # otherwise (mostly text/html cases) use default mode + $p->xml_mode(TRUE) if ($File->{Mode} eq 'XML'); $p->ignore_elements('BODY'); $p->ignore_elements('body'); $p->handler(declaration => $dtd, 'text'); |