/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2016 All Rights Reserved.
 */
package org.dolphin.study.java.xml;

import java.io.InputStream;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 *
 * @author sunqi
 * @version $Id: SAXTest.java, v 0.1 2016118 11:17:22 sunqi Exp $
 */
public class SAXTest {
    /** */
    private static Logger logger = LogManager.getLogger(DomTest.class);

    /**
     * SAXXML
     */
    public void testSaxParse() {
        InputStream inputStream = DomTest.class.getClassLoader().getResourceAsStream(
            "xml/books.xml");
        
    }
}

/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2016 All Rights Reserved.
 */
package org.dolphin.study.java.xml;

import java.io.InputStream;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.xml.sax.helpers.DefaultHandler;

/**
 *
 * @author sunqi
 * @version $Id: SAXTest.java, v 0.1 2016118 11:17:22 sunqi Exp $
 */
public class SAXTest {
    /** */
    private static Logger logger = LogManager.getLogger(DomTest.class);

    /**
     * SAXXML
     */
    public void testSaxParse() {
        try {
            InputStream inputStream = DomTest.class.getClassLoader().getResourceAsStream(
                "xml/books.xml");
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser parser = factory.newSAXParser();
            parser.parse(inputStream, new BooksHandler());
        } catch (Exception e) {
            logger.error("parse exception", e);
        }
    }
}

/**
 *
 * @author sunqi
 * @version $Id: SAXTest.java, v 0.1 2016119 3:52:36 sunqi Exp $
 */
class BooksHandler extends DefaultHandler {

}
add SAXTest