国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

Java核心代碼例程之:(JAXP) XSL Transformation

2019-11-18 15:14:59
字體:
供稿:網(wǎng)友

import javax.xml.transform.*;
import javax.xml.transform.stream.*;

/**
 * TransformDemo uses JAXP to acquire an XML Transformer. It uses the Transformer
 * to transform an XML shopping cart into an Html view of the shopping cart.
 * The Transformer uses transform instrUCtions in an XSLT (.xsl) file.
 *
 * The following JARs must be in your CLASSPATH:
 * - jaxp.jar
 * - xerces.jar (for SAX parser and DOM object implementations)
 * - xalan.jar (for XSLT implementation)
 *
 * Download JAXP (which includes these JARs) here: http://java.sun.com/xml/
 * Find additional Xerces and Xalan info here: http://xml.apache.org/
 *
 * Note: XSLT authoring/PRogramming is beyond the scope of this tutorial.
 * You"ll find good XSL info here: http://www.w3.org/Style/XSL/#learning
 **/

public class TransformDemo
{

  public static void main( String[] args  )
  {
    try
    {
      TransformerFactory factory = TransformerFactory.newInstance();
      System.out.println( "TransformerFactory classname: " + factory.getClass().getName() );

      Transformer transformer = factory.newTransformer( new StreamSource( "cart.xsl" ) );
      System.out.println( "Transformer classname: " + transformer.getClass().getName() );

      //This single line applies the XSL file to transform the XML into HTML.
      transformer.transform( new StreamSource( "cart.xml" ), new StreamResult( System.out ) );

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 陕西省| 太和县| 双鸭山市| 北碚区| 永嘉县| 江安县| 宁远县| 桐乡市| 九龙坡区| 瑞昌市| 鸡东县| 黔江区| 阜宁县| 屏山县| 永胜县| 张家川| 固原市| 根河市| 普陀区| 庄河市| 成武县| 临邑县| 遂昌县| 怀安县| 应用必备| 邢台市| 蕲春县| 仙居县| 广安市| 海城市| 临颍县| 皋兰县| 沁阳市| 和田市| 伊金霍洛旗| 定日县| 理塘县| 郧西县| 永吉县| 台中县| 方城县|