獲得在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