You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Rick Bullotta <Ri...@lighthammer.com> on 2001/03/26 16:14:21 UTC

DOCTYPE not appearing in Xalan Serializer output

Could be a usage issue or "undocumented feature" we're missing...basically
creating an in-memory DOM, then trying to serialize it using the Xalan
Serializer (note: the Xerces serializer works fine).  First glance at the
Xalan source didn't yield any immediate indications as to why it wouldn't be
working.

Regards,

Rick Bullotta
CTO
Lighthammer Software

===================

Here's a code snippet to reproduce:

DocumentImpl doc = new DocumentImpl();

// Add DTD information

String strDocType = "MyDocType";

DocumentType dtd = doc.createDocumentType(strDocType,null,LOCALHOST_PATH +
Constants.DTD_STORAGE_SUBDIRECTORY + strDocType +
Constants.DTD_FILE_EXTENSION);

doc = new DocumentImpl(dtd);

// Create the root element and add it to the tree

Element root =  doc.createElement(strDocType);
doc.appendChild(root);


Serializer serializer =
SerializerFactory.getSerializer(OutputProperties.getDefaultMethodProperties(
"xml"));
serializer.setWriter(System.out);
serializer.asDOMSerializer().serialize(doc);