emilien
15 years agoOccasional Contributor
Inconsistent Xpath results.
I have been having issues trying to get the Xpath result of certain elements. And is causing some discomfort when dealing with transferring elements from one step to another. Sometimes it returns a value, sometimes it returns the whole element. This is rather bothersome to deal with when passing elements from one step to another.
example:
When using the following XPath:
It gives me.
However the following XPath:
Gives me :
When I was expecting something in the same format as the first XPath like:
Is there anyway to get it to return only 150?
example:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<m:registerRequestResponse xmlns:m="http://www.openuri.org/">
<urn:RegisterMapResponse xmlns:urn="urn:oo:pov:ldq:nrm:smis:schema:services">
<urn1:ResponseStatus xmlns:urn1="urn:oo:pov:ldq:schema:util">
<urn1:ReturnCode>Success</urn1:ReturnCode>
</urn1:ResponseStatus>
<urn1:referenceNumber xmlns:urn1="urn:oo:pov:ldq:smis:schema:common">150</urn1:referenceNumber>
<urn1:productInformation xmlns:urn1="urn:oo:pov:ldq:smis:schema:common">
<urn1:productName>XXXX_A4_D</urn1:productName>
<urn1:productDescription>XXXX - A4 CADASTRAL</urn1:productDescription>
<urn1:productCharges gstAmount="0.0" subTotalAmount="0.0" totalAmount="0.0"/>
</urn1:productInformation>
</urn:RegisterMapResponse>
</m:registerRequestResponse>
</env:Body>
</env:Envelope>
When using the following XPath:
declare namespace urn1='urn:oo:pov:ldq:smis:schema:common';
//urn1:productName[1]
It gives me.
XXXX_A4_D
However the following XPath:
declare namespace urn1='urn:oo:pov:ldq:smis:schema:common';
//urn1:referenceNumber[1]
Gives me :
<urn1:referenceNumber xmlns:urn1="urn:oo:pov:ldq:smis:schema:common" xmlns:urn="urn:oo:pov:ldq:nrm:smis:schema:services" xmlns:m="http://www.openuri.org/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">150</urn1:referenceNumber>
When I was expecting something in the same format as the first XPath like:
150
Is there anyway to get it to return only 150?