Here you can find the source of printDoctype(Document doc, PrintStream pstrm)
static private void printDoctype(Document doc, PrintStream pstrm)
//package com.java2s; /* it under the terms of the GNU General Public License as published by */ import org.w3c.dom.Document; import java.io.PrintStream; public class Main { static private void printDoctype(Document doc, PrintStream pstrm) { if (doc.getDoctype() != null) { pstrm.println("<!DOCTYPE " + doc.getDoctype().getName()); String pubid = doc.getDoctype().getPublicId(); if (pubid != null) { pstrm.print("\tPUBLIC \"" + pubid + "\""); }//from w w w . j ava2s . c o m String sysid = doc.getDoctype().getSystemId(); if (sysid != null) { if (pubid != null) { pstrm.println(""); } pstrm.print("\tSYSTEM \"" + sysid + "\""); } pstrm.print(">"); } } }