Re: XHTML: <?xml?> shouldn't be required or a workaround needed for Microsoft stupidity

Jacob Kjome <[email protected]> Tue, 30 Sep 2003 12:47:11 -0500
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
Hi Petr,

At 05:42 PM 9/30/2003 +0200, you wrote:
>Hi,
>
>in short: we need the Xerces parser in XMLC to handle XHTML files
>without the <?xml?> declaration on the first line. Reason: IE6 (and also
>Opera7) does not switch to standards compliant CSS mode if the
><!DOCTYPE> is not the very first line. So lame, I know. But we need to
>live with that somehow.
>
>Some very relevant links:
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp
>http://gutfeldt.ch/matthias/articles/doctypeswitch.html
>
>Solution to this problem has two parts: first, it should be possible to
>XMLCompile a document without the <?xml?> declaration.

Yeah, I guess I can agree with this for XHTML1.0 since XHTML1.0 documents 
don't require the XML header.  Do XHTML1.1 documents require the XML 
header?  I think they do, but I haven't verified this.


>Second, the
>compiled java code should offer a switch to either enable or disable
>generating the <?xml?> at the serialization time (writeDOM). It's
>obvious that the existing XHTMLCompatibility() function would disable
>generating this <?xml?> header..

Have you tried OutputOptions.setOmitXMLHeader(true)?

This is certainly a candidate for automatic setting via 
OutputOptions.setEnableXHTMLCompatibility(true).  I'd certainly like to 
hear opinions from others on this, but I'm not opposed to doing it.


>Please note that http://www.w3.org/TR/xhtml1/#strict says "An XML
>declaration is not required in all XML documents;" so I hope XMLC can be
>fixed to not reply with:
>
>Error: Document appears to be an HTML document; the xerces parser only
>supports XML (does the document start with `<?xml ... ?>'?)

Yes, I hope it won't be too difficult as well, but I guess I'm less 
concerned about the mockups being required to contain the XML header when 
it is so easily stripped upon serialization using OutputOptions.  If this 
is a feature that you need very soon, I suggest digging into the compiler 
and seeing if you can come up with a patch to change this behavior for 
XHTML1.0 documents.  I may get to this, but it won't be a priority for me 
since OutputOptions can already take care of this at runtime with zero 
changes to XMLC.

Jake

>Thanks
>
>Petr
>
>
>_______________________________________________
>XMLC mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/xmlc