Java XML Document Format printDoc(Document doc)

Here you can find the source of printDoc(Document doc)

Description

print Doc

License

Open Source License

Declaration

public static void printDoc(Document doc) 

Method Source Code

//package com.java2s;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;

public class Main {
    public static void printDoc(Document doc) {
        try {//from w  w  w  . java2 s  .c o  m
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer t = tf.newTransformer();
            t.transform(new DOMSource(doc), new StreamResult(System.out));
        } catch (Exception ex) {
            new RuntimeException(ex);
        }
    }
}

Related

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