TrAXUtil.java~3~
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- /**********************************************************************
- 这个类的作用就是简单转换一个XML文件到HTML文件
- **********************************************************************/
- package tsinghuaip;
- import javax.xml.transform.TransformerFactory;
- import javax.xml.transform.Transformer;
- import javax.xml.transform.stream.StreamResult;
- import javax.xml.transform.stream.StreamSource;
- import java.io.*;
- public class TrAXUtil {
- private static TransformerFactory tf = null;
- public static void main(String[] args) throws Exception{
- tf = TransformerFactory.newInstance();
- StreamSource xml = new StreamSource("TsinghuaIPAssign.xml");
- StreamSource xsl = new StreamSource("TsinghuaIPAssign.xsl");
- StreamResult htm = new StreamResult("TsinghuaIPAssign.htm");
- Transformer t = tf.newTransformer(xsl);
- t.transform(xml, htm);
- }
- }