title: Play framework: parse XML to model
body: <p>I have simple entity in webapp driven by Play framework. It looks like this:</p>
  
  <pre><code>case class MyItem(id: Option[Long] = None, name: String, comments: List[Comment])
  case class Comment(commentDate: Date, commentText: String)
  </code></pre>
  
  <p>And I get the XML from DB that looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;item&gt;
      &lt;id&gt;1&lt;/id&gt;
      &lt;name&gt;real item&lt;/name&gt;
      &lt;comments&gt; 
          &lt;comment&gt;
              &lt;comment_date&gt;01.01.1970&lt;/comment_date&gt;
              &lt;comment_text&gt;it rocks&lt;/comment_text&gt;
          &lt;/comment&gt;
          &lt;comment&gt;
              &lt;comment_date&gt;02.01.1970&lt;/comment_date&gt;
              &lt;comment_text&gt;it's terrible&lt;/comment_text&gt;
          &lt;/comment&gt;      
      &lt;/comments&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p>And now I have no idea with parsing it to the model and form mapping.</p>
  
  <p>My form mapping just in case (doesn't compile now):</p>
  
  <pre><code>  val itemForm = Form(
      mapping(
        "id" -&gt; optional(longNumber),
        "name" -&gt; nonEmptyText,
        "comments" -&gt; list(mapping(
            "commentDate" -&gt; date("dd.mm.yyyy"),
            "commentText" -&gt; text
        )(Comment.apply)(Comment.unapply))
      )(MyItem.apply)(MyItem.unapply)
    )
  </code></pre>