Java XML Document Format printDocument(Document document)

Here you can find the source of printDocument(Document document)

Description

prints the given document to system.out

License

Open Source License

Parameter

Parameter Description
document the document, which should be printed

Declaration

public static void printDocument(Document document) 

Method Source Code

//package com.java2s;
/**//www  .  jav  a 2s.  c om
 *
 * BPMN Validation Project to validate special BPMN Constraints, see \README.md
 *
 * Copyright (C) 2014 Philipp Neugebauer
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

import javax.xml.transform.Transformer;

import javax.xml.transform.TransformerException;

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

public class Main {
    private static Transformer transformer;

    /**
     * prints the given document to system.out
     *
     * @param document
     *            the document, which should be printed
     */
    public static void printDocument(Document document) {
        try {
            transformer.transform(new DOMSource(document), new StreamResult(System.out));
        } catch (TransformerException e) {
            System.err.println("printDocument failed cause of " + e);
        }
    }
}

Related

  1. printDocument(Document d)
  2. printDocument(Document doc, boolean prettyPrint)
  3. printDocument(Document doc, OutputStream out)
  4. printDocument(Document doc, Writer ps)
  5. printDocument(Document document)
  6. printDocument(Document document)
  7. printPrettyXML(Document doc)
  8. saveDocumentToFormattedStream(Document doc, OutputStream outputStream)
  9. toFormattedString(Document element)