title: Groovy MarkupBuilder
body: <p>I have a list of things, each of which might be a foo or a bar. I want to build some xml that looks like this:</p>
  
  <pre><code>&lt;rdf:RDF&gt;
    &lt;foo id="1"&gt;
    &lt;foo id="2"&gt;
    &lt;bar id="3"&gt;
  &lt;/rdf:RDF&gt;
  </code></pre>
  
  <p>So I have gotten this far:</p>
  
  <pre><code>MarkupBuilder xml = new MarkupBuilder(writer)
    xml.'rdf:RDF' (nsmap) { }
  </code></pre>
  
  <p>But now I am stuck. How do i - within that <code>xml.'rdf:RDF' (nsmap) { }</code> closure - iterate over my list of stuff? How do i - within that iterator - spit out a foo or a bar element as applicable?</p>