Ed,
I think its a little weird for <f:view> to start rendering stuff,
especially if its only in XML mode. Further, such a change is not
backwards compatible with components that are already outputting the
DOCTYPE.
I think that the most obvious short term solution is h:doctype. However
I think that for the next version we should really look at making things
simple for people who just want to bang in HTML. I think that rather
than going down the whole h: taglib route we really should be looking at
adding taghandler magic such that page authors can bang out elements in
the HTML namespace as they see fit and we handle making some of the
tags, like say <html:head> and <html:body> components if we need to.
If we do that, there are only four cases where we need extra support for
sending XML constructs for interpretation by the browser:
DOCTYPE
comments
processing instructions
CDATA
Of these, the last three don't come up very often and I can live with
page authors needing to place these in CDATA blocks for now. However,
the first of these appears in every page, so I don't see the CDATA
workaround as suitable. So, while I suspect that we didn't need an
<h:html>, I think an <h:doctype> is the best solution to the problem.
-- Blake Sullivan
On 10/26/10 2:10 PM, Ed Burns wrote:
>>>>> On Tue, 26 Oct 2010 13:15:18 -0400, Andy
Schwartz<andy.schwartz(a)oracle.com> said:
AS> BTW, regarding Ed's earlier comment:
EB> the most important manifestation of that, in my opinion, is the
EB> requirement to have *all* elements prefixed. For example, a
EB> proper JSF
EB> XML Syntax View would look like this.
EB>
EB> <?xml version="1.0" encoding="UTF-8"?>
EB> <weNeedSomeRootElement
EB>
xmlns:html="http://www.w3.org/1999/xhtml"
EB>
xmlns:h="http://java.sun.com/jsf/html">
AS> We already have several potential elements/tags that can serve as the
AS> root level element, including eg:
AS> -<html>
AS> -<h:html>
AS> -<f:view>
Ok, here's what we'll do for JSF XML syntax.
<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">
<html>
<h:head><h:title>Title</h:title></h:head>
<h:body>
<h2>HTML elements ok</h2>
</h:body>
</html>
</f:view>
AS> As such I don't believe that we need to add yet another element.
Ok, agreed. It's<f:view> If you want to do Facelets XHTML, then you
just put your stuff on the root<html> element.
AS> This got me to thinking though... I believe that we have a fairly big
AS> gap in our XML strategy: I don't see any straightforward way to specify
AS> a doctypte that will be passed through to the browser. Earlier Dan had
AS> suggested adding new elements for this purpose:
>> 3) All markup declarations should be produced by the component tree
>> (e.g., XML declaration, doctype, namespaces, CDATA, XML comments, etc)
>> This means we need the following tags:
>> f:document
>> f:doctype
>> f:comment (why not, it is just xml)
>> f:cdata
>> (The prefix is debatable, I'm just throwing it out there)
AS> We have added an h:html component in 2.1 - but as far as I can see we
AS> haven't addressed the other items. I think that we minimally need some
AS> way to specify the doctype - eg. an h:doctype element since without this
AS> the documents rendered in our XML processing mode will be doctype-less.
AS> BTW, one thing that I am not totally clear on... What value does
AS> <h:html> add over plain old<html>?
It's a resource target, in addition to rendering the<html> element.
Yes, I read Dan's initial comments but decided to go with the minimal
set you have seen in the design thus far. So, I'll not be introducing
<f:doctype> in this revision.
Ed