[jsr-314-open-mirror] [jsr-314-open] [490-XmlViews] Chapter 11: The JSF XML View Syntax

Cay Horstmann cay.horstmann at gmail.com
Wed Oct 27 00:29:54 EDT 2010


Sure, that's great. Except, it should probably be f:doctype since it
is not HTML specific.

Or, if we cared about consistency with JSP, we could use the same
attributes as jsp:output:

<f:doctype omit-xml-declaration="no"
         doctype-root-element="html"
         doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
         doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

On Wed, Oct 27, 2010 at 9:19 AM, Blake Sullivan
<blake.sullivan at oracle.com> wrote:
> 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.
>
>




More information about the jsr-314-open-mirror mailing list