case Node.ELEMENT_NODE :
serializeElement( (Element) node );
break;
case Node.DOCUMENT_NODE : {
DocumentType docType;
// If there is a document type, use the SAX events to
// serialize it.
docType = ( (Document) node ).getDoctype();
if (docType != null) {
// DOM Level 2 (or higher)
// TODO: result of the following call was assigned to a local variable that was never
// read. Can the call be deleted?
( (Document) node ).getImplementation();
try {
String internal;
printer.enterDTD();
docTypePublicId = docType.getPublicId();
docTypeSystemId = docType.getSystemId();
internal = docType.getInternalSubset();
if ( internal != null && internal.length() > 0 )
printer.printText( internal );
endDTD();
}
// DOM Level 1 -- does implementation have methods?
catch (NoSuchMethodError nsme) {
Class docTypeClass = docType.getClass();
String docTypePublicId = null;
String docTypeSystemId = null;
try {
java.lang.reflect.Method getPublicId = docTypeClass.getMethod("getPublicId", null);