Forum Discussion

ramyaas's avatar
ramyaas
New Contributor
13 years ago

Xpath Match not matching response tag with request tag

My request and response messages are as follows

<v2:Request>
<ifx:MaxRec>25</ifx:MaxRec>
</v2:Request>

<abc:Response>
<ns1:MatchedRec>25</ns1:MatchedRec>
</abc:Response>

When I write an Xpath match like below I'm getting false

//abc:Response/ns1:MatchedRec = //v2:Request/ifx:MaxRec

I have declared all the namespaces in the Xpath assertion.

When I check the tags in a groovy script with the following code, I'm getting the correct result

if (res["//ns1:MatchedRec"] == req["//ifx:MaxRec"]){
log.info "Yes"
}"Yes" is printed in the log.

I am unable to figure out why the xpath match is not giving true as expected. Please help.

1 Reply

  • try
    log.info //abc:Response/ns1:MatchedRec == //v2:Request/ifx:MaxRec


    or

    log.info //abc:Response/ns1:MatchedRec/text() == //v2:Request/ifx:MaxRec/text()