Java XML Document to Stream writeDocument(Document document, OutputStream outputStream)

Here you can find the source of writeDocument(Document document, OutputStream outputStream)

Description

write Document

License

Open Source License

Declaration

public static void writeDocument(Document document, OutputStream outputStream) throws TransformerException 

Method Source Code

//package com.java2s;
/*/*from   ww w  .  j av  a 2 s.c o m*/
 * $Id$
 *
 * Copyright (c) 2002, 2004 Takao Nakaguchi.
 * 
 * This is a program for Language Grid Core Node. This combines multiple language resources and provides composite language services.
 * Copyright (C) 2005-2008 NICT Language Grid Project.
 *
 * 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.1 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, see <http://www.gnu.org/licenses/>.
 */

import java.io.OutputStream;

import java.io.Writer;

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 defaultTransformer;

    /**
     * 
     * 
     */
    public static void writeDocument(Document document, OutputStream outputStream) throws TransformerException {
        defaultTransformer.transform(new DOMSource(document), new StreamResult(outputStream));
    }

    /**
     * 
     * 
     */
    public static void writeDocument(Document document, Writer writer) throws TransformerException {
        defaultTransformer.transform(new DOMSource(document), new StreamResult(writer));
    }

    /**
     * 
     * 
     */
    public static void writeDocument(Document document, StreamResult streamResult) throws TransformerException {
        defaultTransformer.transform(new DOMSource(document), streamResult);
    }
}

Related

  1. writeDocument(Document doc, OutputStream os)
  2. writeDocument(Document doc, OutputStream os)
  3. writeDocument(Document doc, Transformer transformer, OutputStream out)
  4. writeDocument(Document document, OutputStream documentOutputStream)
  5. writeDocument(Document document, OutputStream os)
  6. writeDocument(OutputStream iStream, Element iElement)
  7. writeDocument(OutputStream os, Document document)
  8. writeDocument(OutputStream os, Node node)
  9. writeDocument(OutputStream stream, Document document)