0

此地址http://www.cs12333.com:8001/Service/PersonSearchService处的服务返回以下 XML:

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body><ns2:findPersonListResponse xmlns:ns2="http://service.person.search/">
       <return>
       <result>true</result>
       <resultList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                       xsi:type="ns2:grxxBean">
       <aab001>cooperation</aab001>
       <aac001>34305742</aac001>
       <aac002>430423198906237024</aac002>
       <aac003>licong</aac003>
       <aac004>2</aac004>
       <aac031>2</aac031>`    
       <pwd>1</pwd>
       </resultList>
       </return>
       </ns2:findPersonListResponse>
    </S:Body>
</S:Envelope>

我正在阅读这样的值:

dom = DocumentHelper.parseText(result);
Element root=dom.getRootElement();

根的值为"org.dom4j.tree.DefaultElement@db23f1 [Element: <S:Envelope schemas.xmlsoap.org/soap/envelope/attributes: []/>]"

如何获得 tag 的值<aac003>

4

1 回答 1

0

试试这个 expath 来获得<aac003>价值

/*:Envelope/*:Body/*:findPersonListResponse/*:return/*:resultList/*:aac003
于 2013-05-15T13:43:03.507 回答