> If you're interested in generating text for consumption by web
browsers,
> you may want to look at "XHTML".  If I have it right, XHTML's goal is
to
> be both valid XML and acceptable HTML for browsers.  Which means that
> XHTML generators might well do what you want so as to not have
problems
> with web browsers.

While you could in theory use any XML generator (like Xerces) to
generate
XHTML, if you do so you need a way to deal with the problem Ben raised.
I use Xerces to generate content in the form of XHTML, but its
content-type
is "text/html," because the reality is that the dominant browser can't
handle XHTML served as XHTML.  Consequently, the short-form rendering of
some tags (like <script ../> and <div.../> confuses most browsers.

My (ugly) solution is to make sure such tags have content, even if it's
whitespace.  Another would be to write a generalized serializer that
never uses the short form.  It would be better, though, to write a
serializer that knows what XHTML elements are problematic and guarantees
that they'll be emitted in long form.  You can think of this as using
Xerces to build an XHTML generator like that suggested by Dale.


Reply via email to