获得在XPath节点值我不是不能够在得到了“的ID号”节点值低于响应XML不能通过getNodeValue功能在常规
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SOAP_Customer_Metadata_CALLResponse xmlns="http://BCE/Customer_Metadata_WS.tws">
<oMetaDataID>
<ocrStatus>Failed</ocrStatus>
<guid>123456</guid>
<docType>03</docType>
<docDescription>South African ID</docDescription>
<surname>Choudhary</surname>
<fullName>Kanika</fullName>
<idNumber>KANJANDHS293</idNumber>
<dateOfBirth>22091945</dateOfBirth>
<dateIssued>01012016</dateIssued>
<countryOfBirth>India</countryOfBirth>
<idType>ID</idType>
<gender>F</gender>
</oMetaDataID>
<oMetaDataPOA>
<ocrStatus>Passed</ocrStatus>
<surname>Choudhary</surname>
<idNo>12345</idNo>
<address1>abc def</address1>
</oMetaDataPOA>
<oResubmission>No</oResubmission>
<oCASASequenceNo>1234578</oCASASequenceNo>
<oTypeOfCustomer>New</oTypeOfCustomer>
</SOAP_Customer_Metadata_CALLResponse>
</soapenv:Body>
</soapenv:Envelope>
在Groovy中使用如下代码脚本一步步测试:
holder.getNodeValue("//idNumber")
谢谢@albciff。这个工作得很好。 bur当我试图通过使用holder.getNodeValue(“// *:oMetaDataID/ocrStatus”)访问“oMetaDataID”标签下的“ocrStatus”时,我没有得到任何东西。请帮忙 – Bhushan