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

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

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

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

import javax.xml.parsers.*;
import org.xml.sax.*;


/**
 * SAXDemo uses JAXP to acquire a SAX parser to parse an XML file.
 * The example XML file rePResents a shopping cart.
 *
 * The following JARs must be in your CLASSPATH:
 * - jaxp.jar
 * - xerces.jar (for SAX parser implementation)
 *
 * Download JAXP (which includes these JARs) here: http://java.sun.com/xml/
 * Find additional Xerces info here: http://xml.apache.org/
 *
 * Note: Unlike DOM, SAX parsing does not load the XML file into memory.
 * SAX parsers traverse the XML file and report parse "events" to an event handler.
 **/

 public class SAXDemo
  extends org.xml.sax.HandlerBase
{

  /**
   * main creates and runs a SaxTest instance.
   **/
  public static void main( String[] args )
  {
    SAXDemo me = new SAXDemo();
    me.run();
  }


  public void run()
  {
    try
    {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      log( "SAXParserFactory classname: " + factory.getClass().getName() );

      SAXParser saxParser = factory.newSAXParser();
      log( "SAXParser classname: " + saxParser.getClass().getName() );

      /*
      The SAXParser.parse method initiates parsing of the XML file.
      The second parameter specifies which class will handle parse events.
      This class must extend org.xml.sax.HandlerBase

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 盈江县| 辉县市| 巍山| 铜梁县| 乌拉特中旗| 琼海市| 云林县| 英德市| 基隆市| 邵阳县| 新化县| 雷山县| 海兴县| 周宁县| 专栏| 武隆县| 天等县| 社旗县| 惠州市| 象州县| 嵊州市| 南开区| 高尔夫| 通许县| 鄂托克旗| 庄河市| 洛隆县| 灌云县| 阜南县| 叶城县| 凭祥市| 古蔺县| 淳化县| 甘德县| 策勒县| 土默特右旗| 巴楚县| 景德镇市| 定兴县| 峨眉山市| 广平县|