validator/httpd/cgi-bin check,1.485,1.486

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv6261

Modified Files:
	check 
Log Message:
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



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.485
retrieving revision 1.486
diff -u -d -r1.485 -r1.486
--- check	19 Mar 2007 01:51:21 -0000	1.485
+++ check	22 Mar 2007 14:17:12 -0000	1.486
@@ -1667,8 +1667,12 @@
     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');

Received on Thursday, 22 March 2007 14:17:27 UTC