title: Import XML into a Grails Domain Class
body: <p>I am reading an XML file with a schema based on a Domain Class.</p>
  
  <p>Here is a simple example for illustration (my current situation concerns a lot of fields from a lot of classes) : </p>
  
  <pre><code>class Player {
    String name
    Date birthDate
  }
  </code></pre>
  
  <p>The XML file to read is :</p>
  
  <pre><code>&lt;players&gt;
  &lt;player name='P1' birthDate='12-09-1983'/&gt;
  &lt;/players&gt;
  </code></pre>
  
  <p>So my question is:
  When parsing the XML file, I create Player instances with the following Groovy code:</p>
  
  <pre><code>def players = new XmlSlurper().parse(xmlFile)
  players.player.each() {p -&gt;
    new Player(name: p.@name, birthDate: p.@birthDate).save()
  }
  </code></pre>
  
  <p>Is there another simpler way to do it ? 
  Like params binding when creating/updating a domain object using code like <code>new Player(params)</code> or <code>player.properties = params</code> ? </p>