日期:2014-05-20 浏览次数:20963 次
public class MySax extends DefaultHandler {
private List<LinkMan> all = null;// 保存数据
private LinkMan man = null;
private String elementName = null;
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
// TODO Auto-generated method stub
if (this.elementName != null) {
String data = new String(ch, start, length);
if ("title".equals(this.elementName)) {
this.man.setName(data);
} else if ("email".equals(this.elementName)) {
this.man.setEmail(data);
}
}
}
public LinkMan getMan() {
return man;
}
public void setMan(LinkMan man) {
this.man = man;
}
public String getElementName() {
return elementName;
}
public void setElementName(String elementName) {
this.elementName = elementName;