Forum Discussion

babusr01's avatar
babusr01
Contributor
8 years ago
Solved

how to get node values using Xml Parser

Hi , Team    I am trying to read the node values , but getting empty values.   From my SOAP service response i need to read node values.   I got list nodes and each node i need get the values ...
  • babusr01's avatar
    babusr01
    8 years ago

    log.info BM.children().find( {it.name() == "A"})?.text();

  • nmrao's avatar
    nmrao
    8 years ago

    Even more elegant and precise one would be:

     

    //Closure to show the BM node details
    def showBM = { BM, index ->
      log.info "Detail of BM node ${index}"
    //Print of log - either one
    //BM.children().each { println "${it.name()} : $it" } BM.children().each { log.info "${it.name()} : $it" } }

    Of course, rest of the script is same.