Below is my XML Response:
<env:Envelope xmlns:env="http://schemas" xmlns:wsa="http://www.w3.org">
<env:Body>
<BOR xmlns:oraxsl="http://www.oracle.com" xmlns:oracle-xsl-mapper="http://www.oracle2.com" xmlns:inp1="http://www.oracle2.com.xsd2" xmlns="http://www.oracle2.com.xsd3">
<inp1:C>
<ns0:Id xmlns:ns0="http://www.oracle2.com.xsd4">SK</ns0:Id>
<ns0:Address xmlns:ns0="http://www.oracle2.com.xsd4">
<ns0:Number>4</ns0:Number>
</ns0:Address>
</inp1:C>
</BOR>
</env:Body>
</env:Envelope>
I can pass if I want to validate ns0:Number element with below code.
var jsonObject = xml2Json(responseBody);
console.log(jsonObject);
tests["Check Mode Id is 4 "+jsonObject['env:Envelope']['env:Body'].BOR['inp1:C']['ns0:Address']['ns0:Number']] = jsonObject['env:Envelope']['env:Envelope']['env:Body'].BOR['inp1:C']['ns0:Address']['ns0:Number']=== "4";
But if I want to validate ns0:Id it is providing [object Object] | AssertionError: expected false to be truthy
I guess this is due to ns0:Id element have xmlns:ns0="http://www.oracle2.com.xsd4. So how to validate ns0:Id element value is my question. Code need fix is below.
tests["Check Id is SK "+jsonObject['env:Envelope']['env:Body'].BOR['inp1:C']['ns0:Id']] = jsonObject['env:Envelope']['env:Body'].BOR['inp1:C']['ns0:Id'] === "SK";