2013-05-15 34 views
0

服務的XML字符串在這個地址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(); 

根的價值"[email protected] [Element: <S:Envelope schemas.xmlsoap.org/soap/envelope/attributes: []/>]"

如何獲得標籤<aac003>的價值?

+2

您應該使用的,而不是手動解析此相應的Web服務(SOAP)客戶端實現。 –

回答

0

試試這個expath得到<aac003>

/*:Envelope/*:Body/*:findPersonListResponse/*:return/*:resultList/*:aac003