Forum Discussion

Mis3's avatar
Mis3
Frequent Contributor
3 years ago
Solved

Output some selected parameters of XML response to a log file

I tried to output certain parameters of a XML response (below) to a log file. The parameters I like to output:  CoSID, PIN, iPhoneDevice, etc.   Not sure how to do this.   def xmlResponse = tStep....
  • nmrao's avatar
    3 years ago

    Looks the data fields are unique in this case; so easy to extract with a simple closure.

     

     

    def getData = { item -> xml.'**'.find{it.name() == item }?.text() }
    //You may use log.info or assign value instead of print if you want to process that info further.
    println getData('ResultCode')
    println getData('ExtendedResultCode')
    println getData('CoSID')
    println getData('PIN')
    println getData('iPhoneDevice')