title: How to write xml into a file using MarkupBuilder
body: <p>I created an xml using MarkupBuilder in groovy but how do i write it into a xml file in my project dir <code>E:\tomcat 5.5\webapps\csm\include\xml</code></p>
  
  <pre><code>def writer = new StringWriter()
      def xml = new MarkupBuilder(writer)
      String[] splitted
  
      xml.rows()
      {   for(int i=0;i&lt;lines.length-1;i++){
              row()
              {
                  for(int j=0;j&lt;lines[i].length();j++)
                  {
                       splitted= lines[i].split(',');
                  }
                  name(splitted[0])
                  email(splitted[1])
  
              }
          }
      }
  </code></pre>
  
  <p>here <code>println writer.toString()</code> prints my whole xml content but i need it in a file in my tomcat project's  <code>xml</code> directory</p>