[Classpathx-xml] GNUJAXP.JAR Bug in gnu.xml.pipeline.TextConsumer constr
From:
Arnd Beißner
Subject:
[Classpathx-xml] GNUJAXP.JAR Bug in gnu.xml.pipeline.TextConsumer constructor
Date:
Tue, 2 Apr 2002 11:00:01 +0100
Hi there,
I found the following bug in JAXP 1.0beta1 (distribution download):
when the TextConsumer class is used to emit plain XML (not specially handled XHTML),
the XML declaration is missing in the output TextConsumer produces.
The XMLWriter class does not emit the XML declaration if no encoding
is given. TextConsumer passes null for the encoding parameter is isXhtml
is false.
My opinion:
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.