Forum Discussion

bc1234's avatar
bc1234
New Contributor
14 years ago

Reading conditional XML

I have below SOAP response:

I need to pick <Address> and <nId> having nIdType="ACTIVE" .

There could be more Address and nId and I need to pick the first match one.

I wrote groovy script and not got any success .please help me as I am new

There could be possible that all Address may or mayn't have nId

I have test property where I need to update both Address and nId

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:GetD xmlns:ns2="http://xyxz/pqr" xmlns:ns3="http://pqp/ptr" xmlns:ns4="http://nhgg./ns">

<ns2:du>
<ns2:Address>UUUUUU</ns2:macAddress>
</ns2:du>
<ns2:du>
<ns2:Address>XXXXXXX</ns2:macAddress>
</ns2:du>
<ns2:du>
<ns2:Address>PQWWEEE</ns2:macAddress>
<ns2:dP>
<ns2:pN>1</ns2:pN>
<ns2:sE>
<ns2:nId>08767727</ns2:nId>
<ns2:nIdType>ACTIVE</ns2:nIdType>
</ns2:sE>
</ns2:dP>

</ns2:du>
<ns2:du>
<ns2:Address>TTTTTTTT</ns2:macAddress>
</ns2:du>
</ns2:GetD>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
No RepliesBe the first to reply