我是用kxml包来解析的。详情请看
http://blog.163.com/li_wang157/blog/static/180556134201172711497228/if (eventType == XmlPullParser.START_TAG
&& parser.getName().equals("rfid")) {// 解析RFID.xml
eventType = parser.nextTag();
if (parser.getName().equals("rname")) { //判断是否有rname标签
// 提取name值 parser.nextText()
rfidCard.setRname(parser.nextText());
}
// 读取下一个标签
eventType = parser.nextTag();
if (parser.getName().equals("cardnumber")) {
rfidCard.setCardnumber(parser.nextText());
}
eventType = parser.nextTag();
if (parser.getName().equals("team")) {
rfidCard.setTeam(parser.nextText());
}
eventType = parser.nextTag();
if (parser.getName().equals("power")) {
rfidCard.setPower(parser.nextText());
}
ContentManager.GetInstance().AddRfidRecord(rfidCard);
}本回答被提问者采纳