📄 xmlcounterhandler.java
字号:
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package ynu.edu.cn.sei.stoneagedict.util;import org.xml.sax.Attributes;import org.xml.sax.helpers.DefaultHandler;/** * 对xml进行解析并统计出词汇量. * @author zy * @version 1.0.0.0, Mar 18, 2008 */public class XMLCounterHandler extends DefaultHandler { private String wordMark = null; private int num = 0; public void startElement(String namespaceURI, String lname, String qname, Attributes attrs) { if(lname.equalsIgnoreCase(this.wordMark)){ num++; System.out.println(lname); } } public int getNum() { return num; } public void setWordMark(String wordMark) { this.wordMark = wordMark; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -