I think both XMLWriter and TextConsumer are at fault here. I understand
the reason for omitting the XML delaration when (X)HTML output is desired.
However, the encoding parameter of XMLWriter's constructor should not be
hijacked for that purpose. I'd say there needs to be a separate property for this
AND TextConsumer needs my fix AND TextConsumer should have a
constructor of the form public TextConsumer (Writer w, String encoding, boolean isXhtml)
The TextConsumer constructor with a Writer argument is sometimes preferable over the
OutputStream variant - for example when you want output to a String - there's a StringWriter
standard class but not a StringBufferOutputStream.