SAX解析器
2015-08-03 21:01
387 查看
;
import javax.swing.DefaultBoundedRangeModel;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class MySAXHandler extends DefaultHandler{
private boolean isArray;
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
public void startDocument() throws SAXException {
}
import javax.swing.DefaultBoundedRangeModel;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class MySAXHandler extends DefaultHandler{
private boolean isArray;
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
super.characters(ch, start, length); if(isArray){ System.out.println("我终于找到这个xcz的值了"+new String(ch,start,length)); System.out.println(new String(ch,start,length)); } } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); System.out.println(localName+"标签结束"+qName); } @Override public void endDocument() throws SAXException { super.endDocument(); System.out.println("解析文档结束"); }
public void startDocument() throws SAXException {
super.startDocument(); System.out.println("解析文档开始"); } @Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); isArray=qName.equals("xcz"); System.out.println(localName+"标签开始"+qName); }
}
相关文章推荐
- uva 1600
- 欢迎使用CSDN-markdown编辑器
- Linux内核——伙伴系统和slab缓存
- socket选项总结(setsocketopt)
- DOM解析器
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- Linux stat 命令
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)
- 线性探测法构造哈希表(hash)