Use case:
In this scenario, we will demonstrate how to retrieve the value of the ErrMsg field in XML using the local-name() XPath function, bypassing the need for a namespace prefix.
The following response was received from an endpoint where the namespace prefix is missing. Our objective is to retrieve the value of the ErrMsg field for further post processing logic:
<enb:ImportDataResponse xmlns:enb="enablon">
<Response>
<RowCount>2</RowCount>
<RowSuc>2</RowSuc>
<ErrMsg />
</Response>
</enb:ImportDataResponse>
Solution:
We need to use xslt xpath function: local-name() as below:
$Invoke_SkillsAssessment_ImportData_Enablon//*[local-name()='Response']/*[local-name()='ErrMsg']
No comments:
Post a Comment