2013-05-15 3 views
0

Службы по этому адресу http://www.cs12333.com:8001/Service/PersonSearchService возвращает следующий XML:мне нужно проанализировать строку 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 Services (SOAP), вместо разбора вручную. –

ответ

0

Попробуйте expath, чтобы получить <aac003> значение,

/*:Envelope/*:Body/*:findPersonListResponse/*:return/*:resultList/*:aac003 
Смежные вопросы