Source Code : Use the transform.TransformerFactory plugability in the JAXP API

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Use the transform.TransformerFactory plugability in the JAXP API

      

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class MainClass {
  public static void main(String[] args) throws TransformerException,
      TransformerConfigurationException, FileNotFoundException, IOException {
    if (args.length != 3) {
      System.out.println("Usage: java jaxpTransform inXML inXSLT outFile");
      System.exit(0);
    }
    FileOutputStream outstream = new FileOutputStream(args[2]);

    TransformerFactory tfactory = TransformerFactory.newInstance();
    StreamSource insource = new StreamSource(args[0]);
    StreamSource inxsl = new StreamSource(args[1]);
    StreamResult sresult = new StreamResult(outstream);
    Transformer transformer = tfactory.newTransformer(inxsl);
    transformer.transform(insource, sresult);
  }
}

   
    
    
    
    
  

Thank with us