解析xml的单个节点值和循环节点消息体
//获取单个节点文本内容
String total = doc.selectSingleNode("/message/body/params/total").getText();
//获取xml循环消息体
List<Node> beannodes = doc.selectNodes("/message/body/paramlist/bean");
Eperson[] epersonList = new Eperson[beannodes.size()];
for (int i = 0; i < beannodes.size(); i++)
{
Eperson eperson = new Eperson();
//有node节点再获取单个节点文本内容
String staffid = beannodes.get(i).selectSingleNode("./staffno").getText();
String name = beannodes.get(i).selectSingleNode("./name").getText();
String staffaccount = beannodes.get(i).selectSingleNode("./staffaccount").getText();
String staffno = beannodes.get(i).selectSingleNode("./staffno").getText();
String sex = beannodes.get(i).selectSingleNode("./sex").getText();
String mobile = beannodes.get(i).selectSingleNode("./mobile").getText();
String homephone = beannodes.get(i).selectSingleNode("./homephone").getText();
String fax = beannodes.get(i).selectSingleNode("./fax").getText();
String email = beannodes.get(i).selectSingleNode("./email").getText();
String bindno = beannodes.get(i).selectSingleNode("./bindno").getText();
String shortphone = beannodes.get(i).selectSingleNode("./shortphone").getText();
String officephone = beannodes.get(i).selectSingleNode("./officephone").getText();
String credit = beannodes.get(i).selectSingleNode("./credit").getText();
;
String underWrite = beannodes.get(i).selectSingleNode("./underwrite").getText();
;
String voip = beannodes.get(i).selectSingleNode("./voip").getText();
;
String addr = beannodes.get(i).selectSingleNode("./addr").getText();
;
String otherPhone = beannodes.get(i).selectSingleNode("./otherphone").getText();
;
String zip = beannodes.get(i).selectSingleNode("./zip").getText();
;
String seat = beannodes.get(i).selectSingleNode("./seat").getText();
;
eperson.setStaffid(staffid);
eperson.setName(name);
eperson.setStaffaccount(staffaccount);
eperson.setStaffno(staffno);
eperson.setSex(sex);
eperson.setMobile(mobile);
eperson.setHomephone(homephone);
eperson.setFax(fax);
eperson.setEmail(staffaccount + Configuration.getInstance().getEmailTail());
eperson.setBindno(bindno);
eperson.setShortphone(shortphone);
eperson.setOfficephone(officephone);
eperson.setCredit(credit);
eperson.setUnderWrite(underWrite);
eperson.setVoip(voip);
eperson.setAddr(addr);
eperson.setOtherPhone(otherPhone);
eperson.setZip(zip);
eperson.setSeat(seat);
epersonList[i] = eperson;
epersonBean.setEpersonList(epersonList);
}