import java.util.ArrayList;
import java.util.List;

import org.import org.import org.import org.import org.

public class XercesTest extends DefaultHandler {
//    static{
//        System.out.print("AAA");
//        System.exit(0);
//    }
    /**
     * 一段使用Xerces解析     * @param args
     */
    public static void main(String[] args) throws Exception {
       System.out.println("hello world!");
       //(new XercesTest()).run(args[0]);
       (new XercesTest()).run("member.    }

    public void run(String file) throws Exception {
       
               parser.setContentHandler(this);
        parser.parse(file);
    }

    public void startDocument() throws SAXException {
        System.out.println("starting parse    }

    public void startElement(String uri, String localName, String rawName, Attributes attlist) throws SAXException {
        System.out.println(localName);
    }

    public void endElement(String uri, String localName, String rawName) throws SAXException {
    }

    public void characters(char[] ch, int start, int length) throws SAXException {
        System.out.println(new String(ch, start, length));
    }

    public void endDocument() throws SAXException {
        System.out.println("end parse    }
}

member.

11-14 07:39
查看更多