Friday, October 29, 2010

Re: How to generate xhtml using GWT

On 29 oct, 11:42, Jan <> wrote:
> Hi all,
> I have a question regarding the markup, which gwt generates.
> If I use
> HTML test = new HTML();
> test.setHTML("<br/>");
> The command test.getHTML() returns "<br>", which is html but not
> xhtml. (The function stands to its name)
> However I would like to reuse the final markup of the webpage. So is
> it possible to change the default output from html to xhtml?

GWT doesn't "generate HTML", it generates JavaScript which only
manipulates the DOM (mostly, there are cases where it generates HTML
snippets that it gives to .innerHTML; and the generated *.nocache.js
uses document.write()).
But is this really an issue, given that "the Web" does not do XHTML? XHTML is dead, HTML is the past (IE6
anyone?), the present and the future (HTML5).
And the *.nocache.js use of document.write() makes unusable within
application/xhtml+xml files.

That begin said, it'd be quite easy to generate a *.nocache.js that
does not do document.write() (it'd be tricky to detect stylesheet and
JS dependencies' load though), and not that hard to have widgets not
to use innerHTML (or at a minimum generate XHTML-compatible, aka
"polyglot", code for use with innerHTML). My opinion is that it's not
worth it, YMMV.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment