@wendal
先给出xml原文
<?xml version="1.0" encoding="utf-8"?>
<returnsms>
<statusbox>
<mobile>13701000041</mobile>
<taskid>16031026</taskid>
<status>20</status>
<receivetime>2016/8/24 16:10:12</receivetime>
<errorcode>S:6</errorcode>
<extno/>
</statusbox>
<statusbox>
<mobile>18600321144</mobile>
<taskid>16031026</taskid>
<status>20</status>
<receivetime>2016/8/24 16:10:12</receivetime>
<errorcode>S:6</errorcode>
<extno/>
</statusbox>
</returnsms>
然后是我的代码
Element element = Xmls.xml(Lang.ins(xml)).getDocumentElement();
Element returnsms = Xmls.getEle(element, "//returnsms");
List<Element> statusboxList = Xmls.children(returnsms);
for (Element statusbox : statusboxList) {
System.out.println(Xmls.getText(Xmls.getEle(statusbox, "//mobile")));
}
正常来讲,理论上应该是打印
13701000041
18600321144
结果呢,打印了两次
13701000041
13701000041