Re: XHTML Validator question

"Mcguigan, Thomas C (Tom), NBSO" wrote:
> 
> Attached please find temp2.htm, which I just tried to validate (using the
> file upload function).  The Validator results were:
> 
> File: g:\tmcguigan\temp2.htm
> Character encoding: unknown
> Document type: XML
> Below are the results of checking this document for XML well-formedness and
> validity.
> 
> Uh oh! I got the following unknown error:
> /usr/local/bin/nsgmls:http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd:236:
> 27:E: omitted tag minimization parameter can be omitted only if "OMITTAG NO"
> is specified on the SGML declaration Please make sure you specified the
> DOCTYPE properly!
[...]
> If I remove the first line, the file passes validation.
> 
> The file, with the first line in place, passes both the 2000/02/24 version
> of Validator and the WDG validator as type XHTML-Strict.

No way, no how, does that pass validation in check 1.63!

The problem is that MSIE is uploading the file as application/xml
instead of text/html whenever you insert an XML PI at the beginning of
the file. The validator accepts this at face value and treats the file
as XML and never even tries to sniff out DOCTYPEs and similar.
Unfortunately there is a bug in the Validator that makes it treat
explicitly labelled XML (as opposed to "sneak XML" like XHTML) as pure
SGML (i.e. HTML). When SP in SGML mode is fed the XHTML DTD it chokes
producing the error message above.

The attached patch to "check" should take care of it[0].

HTH, -link


[0] - But note that I haven't done extensive testing so it may have odd
side-effects.
      I don't think so though...
Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.66
diff -c -r1.66 check
*** check	2000/06/30 20:33:50	1.66
--- check	2000/08/09 08:51:39
***************
*** 347,353 ****
      $xmlflags            .= '-wno-valid ';
    }
    $decl                  = $xhtmldecl;
! } elsif ($guessed_doctype == 2) { # no doctype, with xmlns attr on 1st element
    $File->{Type} = 'xml';	# @@ probably a better way to do this
    $ENV{SGML_CATALOG_FILES} = $sgmlstuff . '/sp-1.3/pubtext/xml.soc';
    $ENV{SGML_SEARCH_PATH} = $sgmlstuff . '/sp-1.3/pubtext/';
--- 347,353 ----
      $xmlflags            .= '-wno-valid ';
    }
    $decl                  = $xhtmldecl;
! } elsif ($guessed_doctype == 2 or $File->{Type} eq 'xml') { # no doctype, with xmlns attr on 1st element
    $File->{Type} = 'xml';	# @@ probably a better way to do this
    $ENV{SGML_CATALOG_FILES} = $sgmlstuff . '/sp-1.3/pubtext/xml.soc';
    $ENV{SGML_SEARCH_PATH} = $sgmlstuff . '/sp-1.3/pubtext/';

Received on Wednesday, 9 August 2000 05:01:19 UTC