title: Generate xml element named 'properties' with StreamingMarkupBuilder
body: <p>I need to generate some xml that includes an element called "properties". When I attempt the following, I notice that groovy is trying to get the properties of my class, as evidenced by its call to <code>getSomething</code>. It should instead only generate an element named "properties".</p>
  
  <pre><code>class XMLGen
  {
      public String getSomething() {
          println "Got something"
      }
  
      public String genXml()
      {
          def myProps = ['a':1, 'b':2]
  
          def xml = new groovy.xml.StreamingMarkupBuilder().bind{
              rootTag{
                  properties{ // ???
                      myProps.each{ prop -&gt;
                          property(key: prop.key, value: prop.value)
                      }
                  }
              }
          }
          return groovy.xml.XmlUtil.serialize(xml)
      }
  }
  
  println new XMLGen().genXml()
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Got something
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;rootTag&gt;
    &lt;properties&gt;
      &lt;property key="a" value="1"/&gt;
      &lt;property key="b" value="2"/&gt;
    &lt;/properties&gt;
  &lt;/rootTag&gt;
  </code></pre>
  
  <p>How would I explicitly "tell" groovy to pass the method call on line (marked ???) to the markup builder?</p>
  
  <p>(Asking this question and answering it myself as I couldn't find a solution for this anywhere, but eventually "guessed" the right answer)</p>