xsltmanager.java

来自「此程序都是企业级 的数据库开发程序 全面揭示了JAVA对数据库的操作」· Java 代码 · 共 42 行

JAVA
42
字号
package mvc;/* These classes are found in the Xerces jar file (Xerces.jar) */import org.w3c.dom.Document;/* * These classes are part of the J2EE jar file or if you are using JBoss/tomcat * the servlet.jar file found in your Tomcat/lib directory. */import javax.servlet.jsp.JspWriter;/* Imported from the Xalan.jar */import javax.xml.transform.TransformerFactory;import javax.xml.transform.Transformer;import javax.xml.transform.stream.StreamResult;import javax.xml.transform.stream.StreamSource;import org.apache.xalan.processor.TransformerFactoryImpl;import javax.xml.transform.dom.DOMSource;public class XSLTManager {  /*   * The transformOutput method will transform an XML Document and XSL stylesheet   * into HTML and then write the HTML out to the JspWrite passed into the method   * call.   */  public void transformOutput(JspWriter _out, Document _xmlDoc,                               String _xslFileName) throws Exception {    TransformerFactory tFactory = new TransformerFactoryImpl();    Transformer transformer =       tFactory.newTransformer(new StreamSource(_xslFileName));    DOMSource domSource = new DOMSource(_xmlDoc);    transformer.transform(domSource, new StreamResult(_out));  } }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?