From: Jenny B. <sk...@gm...> - 2008-04-16 16:26:02
|
On Tue, Apr 15, 2008 at 11:49 PM, Jacob Kjome <ho...@vi...> wrote: > Yeah, if you have "html" as the output type, then it should use the HTML > serializer. Although, why do you specify "no" to OutputKeys.OMIT_XML_DECLARATION? > You don't want that for HTML and, actually, not even for XHTML. Browsers > don't handle HTML/XHTML documents with the XML declaration very well. > Also, I don't recommend using the StringWriter for output in a servlet. I would > think you'd want to pass in the ServletOutputStream into the StreamResult. Ok I just fixed the xml declaration thing. I'm using StringWriter because this is actually used in a batch mode (not servlet at all) and it's in the middle of the pipeline of modules handling the data. I know for sure that the incoming data is a String in UTF-8 and that the next item in line will also want it as a String in UTF-8. (And I'm making sure the meta tag charset also says UTF-8 even if I make it so myself.) Eventually in the long term a browser may see the html that results, but not immediately; many other things happen to the data first. I need the html in memory for a while yet after, so, String. > > I'm using Xalan 2.7.1 and Xerces 2.9.1, and this is a small enough > > code base I'm pretty sure there are no jar conflicts sneaking in old > > versions. Rather I suspect I'm misunderstanding something about the > > serialization process or xml / html specifications. > > > > Are you sure you have serializer.jar from the Xalan-2.7.1 distribution in the > classpath? I just double checked that this morning, and I'm seeing the same behavior (XML style serialization) after specifically putting Xalan's copies of everything in place. Any more ideas? Are there get methods or debug info that I can use with the Transformer to find out what it thinks it's using / supposed to be using, so I can see if something specific is going wrong? Thank you. Jenny Brown |