Java XML Transform createTXT(Transformer xf, Node doc)

Here you can find the source of createTXT(Transformer xf, Node doc)

Description

create TXT

License

Open Source License

Declaration

public static String createTXT(Transformer xf, Node doc) throws Exception 

Method Source Code

//package com.java2s;

import java.io.ByteArrayOutputStream;

import java.io.OutputStream;

import javax.xml.transform.Transformer;

import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Node;

public class Main {
    public static String createTXT(Transformer xf, Node doc) throws Exception {
        OutputStream os = new ByteArrayOutputStream();
        StreamResult res = new StreamResult(os);
        xf.transform(new DOMSource(doc), res);
        os.close();/*from  ww w .ja v a  2  s.  co m*/
        return os.toString();
    }
}

Related

  1. createTransformer()
  2. createTransformer()
  3. createTransformer()
  4. createTransformer(final File xsltFile)
  5. createTransformerHandler(int indent)
  6. exceptionToString(TransformerException exception, boolean showSystemId)
  7. getDefaultTransformerFactoryThreadLocal()
  8. getNewTransformer()
  9. getThreadedIdentityTransformer( boolean omitXmlDeclaration)