title: evaluating value of an expression as expression in groovy
body: <p>Here is the code i am trying to get working</p>
  
  <pre><code>    def expr = ''
      List params = []
      params &lt;&lt; 'filter-name'
      params &lt;&lt; 'servlet-name'
      params &lt;&lt; 'url-pattern'
  
      params.each{expr = expr+ "it.'${it}'.text().trim()#"}
      expr = expr.substring(0, expr.length()-1)
  
      consNodes.each{
          println "data is:$"{expr}"
          println "actual : ${it.'filter-name'.text().trim()}#${it.'servlet-name'.text().trim()}#${it.'url-pattern'.text().trim()}"
  }
  </code></pre>
  
  <p>in the above result comes like</p>
  
  <pre><code>data is:it.'filter-name'.text().trim()#it.'servlet-name'.text().trim()#it.'url-pattern'.text().trim()
  actual : presenceLogoutFilter##/adfAuthentication/*
  data is:it.'filter-name'.text().trim()#it.'servlet-name'.text().trim()#it.'url-pattern'.text().trim()
  actual : remoteApplication##/rr/*
  data is:it.'filter-name'.text().trim()#it.'servlet-name'.text().trim()#it.'url-pattern'.text().trim()
  actual : ServletADFContextFilter#GetHandler#
  data is:it.'filter-name'.text().trim()#it.'servlet-name'.text().trim()#it.'url-pattern'.text().trim()
  actual : ServletADFContextFilter##/PresenceServlet/*
  </code></pre>
  
  <p>So, as you can see that my constructed expression is not able to evaluate further. Any advise on how to make it work?</p>