You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/11/09 13:44:34 UTC
DO NOT REPLY [Bug 1121] -
DOCTYPE not written to serialized output for an in-memory DOM
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1121>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1121
DOCTYPE not written to serialized output for an in-memory DOM
------- Additional Comments From angus@pobox.com 2001-11-09 04:44 -------
I believe this may be a more general problem. I have observed the same
thing (DOCTYPE not written) when using a serializer with
'asContentHandler' rather than 'asDOMSerializer', and outputting 'html'
rather than 'xml'.
Here's some code:
StreamSource xmlSource = new StreamSource(sourcefile);
xmlSource.setSystemId(sourcefile);
Source stylesheet =
tfactory.getAssociatedStylesheet(xmlSource, media, title, charset);
TransformerHandler mainhandler =
saxtfactory.newTransformerHandler(stylesheet);
XMLReader reader = XMLReaderFactory.createXMLReader();
reader.setContentHandler(mainhandler);
reader.setProperty("http://xml.org/sax/properties/lexical-handler",
mainhandler);
Serializer serializer = SerializerFactory.getSerializer
(OutputProperties.getDefaultMethodProperties("html"));
serializer.setOutputStream(new FileOutputStream(targetfile));
mainhandler.setResult(new SAXResult(serializer.asContentHandler()));