Java XML Transform transform(InputStream xslis, InputStream xmlis, OutputStream xmlos)

Here you can find the source of transform(InputStream xslis, InputStream xmlis, OutputStream xmlos)

Description

transform

License

Open Source License

Declaration

public static void transform(InputStream xslis, InputStream xmlis, OutputStream xmlos) 

Method Source Code


//package com.java2s;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class Main {
    public static void transform(InputStream xslis, InputStream xmlis, OutputStream xmlos) {
        try {/*  ww w  .  ja v a  2s.c  o  m*/
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(new StreamSource(xslis));
            transformer.transform(new StreamSource(xmlis), new StreamResult(xmlos));
            xslis.close();
            xmlis.close();
            xmlos.close();
        } catch (Exception e) {
            throw new RuntimeException("Fail to do XSLT transformation", e);
        }
    }
}

Related

  1. transform(final File sourceXML, final File xslt, final File targetXML)
  2. transform(final Source xml, final Source xslt, final Map params, final Writer err)
  3. transform(InputStream styleSheet, InputStream xml, Writer out)
  4. transform(InputStream styleSheet, InputStream xml, Writer out)
  5. transform(InputStream xmlStream, InputStream xslStream, OutputStream outputStream)
  6. transform(InputStream xsltInputStream, InputStream xmlInputStream, OutputStream outputStream, Map parameterMap)
  7. transform(javax.xml.transform.Source source, javax.xml.transform.Result result, boolean indent)
  8. transform(Reader source, Writer result, String style)
  9. transform(SOAPPart part)