Java XML Document Format printDoctype(Document doc, PrintStream pstrm)

Here you can find the source of printDoctype(Document doc, PrintStream pstrm)

Description

print Doctype

License

Open Source License

Declaration

static private void printDoctype(Document doc, PrintStream pstrm) 

Method Source Code

//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(">");
        }
    }
}

Related

  1. prettyPrintXml(Document document)
  2. prettyPrintXMLDocument(Node node)
  3. print(Document d)
  4. printDoc(Document doc)
  5. printDoc(Document doc, PrintStream pstrm)
  6. printDocument(Document d)
  7. printDocument(Document doc, boolean prettyPrint)
  8. printDocument(Document doc, OutputStream out)
  9. printDocument(Document doc, Writer ps)