Created
March 18, 2015 17:55
-
-
Save rootasjey/465695e2ebdcb337b3ae to your computer and use it in GitHub Desktop.
How to transform a xml file with a xls style file in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
import org.xml.sax.SAXException; | |
public class Styliser { | |
public static void main(String[] args) throws TransformerException, TransformerConfigurationException, | |
SAXException, IOException | |
{ | |
System.out.println("Transforming..."); | |
TransformerFactory tFactory = TransformerFactory.newInstance(); | |
Transformer transformer = tFactory.newTransformer(new StreamSource("style.xsl")); | |
transformer.transform(new StreamSource("file.xml"), new StreamResult("out.xml")); | |
System.out.println("Transormation is done!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment