I agree. Every single generated HTML document needs a doc-type.
I was proposing something like this:
<f:view
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:doctype>html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"</h:doctype>
<html>
<h:head><h:title>Title</h:title></h:head>
<h:body>
<h2>HTML elements ok</h2>
</h:body>
</html>
</f:view>
There a re a bunch of different ways that a docType tag could be
implemented, but I thought this might be the easiest for customers who
are really just copying and pasting and don't want to know what the
different parts of the DOCTYPE mean.
-- Blake Sullivan
On 10/26/10 7:02 PM, Cay Horstmann wrote:
Just from the point of view of namespaces, you can certainly use
html
as the root. The difficulty is the doctype. An XML processing tool has
every reason to expect that a document starting with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
is a conforming document.
However, a JSF page is not--it aims to produce such a document (at
least when rendered to XHTML).
That's why today you get wiggly underlines in editors, exceptions in
XSLT scripts, and so on, when you try to process JSF pages.
So, the DOCTYPE needs to be output, not included. That could be done
with attributes of a top level element or with a child element.
That means the top element should not be html, but it could be h:html,
or, of course, f:view.
Cheers,
Cay
NB. Not having an option for rendering a DOCTYPE would be bad--we want
users to be able to produce proper XHTML. For one thing, if you omit
the DOCTYPE, you can trigger quirks mode in commonly used browsers.