Java XML Transform transform(Transformer transformer, Node element)

Here you can find the source of transform(Transformer transformer, Node element)

Description

transform

License

Open Source License

Declaration

private static final String transform(Transformer transformer, Node element) throws TransformerException 

Method Source Code

//package com.java2s;

import java.io.StringWriter;

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.Node;

public class Main {
    private static final String transform(Transformer transformer, Node element) throws TransformerException {
        StreamResult result = new StreamResult(new StringWriter());
        DOMSource source = new DOMSource(element);
        transformer.transform(source, result);

        String xmlString = result.getWriter().toString();
        return xmlString;
    }/*  w  ww. j av a2 s . c  om*/
}

Related

  1. transform(Source xsl, Source xml, Result result)
  2. transform(String xmlInputFile, String xsltInputFile, OutputStream outputStream)
  3. transform(String xmlInURI, String xslInURI)
  4. transform(String xmlsource, File xsltfile)
  5. transform(String xslSource, Node original)
  6. transformar(String xmlOrigen, String xslOrigen)
  7. transformer()
  8. transformerExceptionMsg(TransformerException ex, Node contextNode, String str)
  9. transformerFactory()