Forum Discussion

Mis3's avatar
Frequent Contributor
3 years ago a field in a XML response

I tried to retrieve a field in a  XML response.  Not sure how to do it because there is no tag to this field.

Below is the partial XML response.  

I like to output if the response contains the block flag ("<blocked/>").     If not blocked, this line would be missing.



<soap:Envelope xmlns:soap="">
<ns2:getMsisdnDataResponse resultCode="0" message="success" xmlns:ns2="">
<msisdnData msisdn="1113366121">
<basicImsiData imsi="130000011142">


1 Reply

  • Mis3's avatar
    Frequent Contributor

    I figured a way to do this:

    if (xmlResponse.contains('blocked/') ) 

    {  block_ind = "blocked"  }


    While this works, it is not elegance.  What if I have the same string in other part of the XML response for other purpose?

    Is there a better way to extract this parameter?