title: Using external string variable with Groovy Markup Builder
body: <p>I have created a string variable using some logic in groovy which reflects the braket syntax in markup builder but the problem is that you are obviously not allowed to use this string in markup  builder. The nature of my code makes it necessary. I want to know if there is a way of doing something like the following</p>
  
  <pre><code>def param = "node1{ node2{ node3() } }"
  def sw = new StringWriter()
  def xml = new groovy.xml.MarkupBuilder(sw)
  
  XML = xml.param
  </code></pre>
  
  <p>I know the above code is not correct but is there a way of doing what i am driving at? To be clear param is a string which is the product of another piece of code. I am looking to get out a piece of XML like the following:</p>
  
  <pre><code>&lt;node1&gt;&lt;node2&gt;&lt;node3/&gt;&lt;/node2&gt;&lt;node1&gt;
  </code></pre>
  
  <p>Thanks</p>