title: Can not parse the Elem from XML in Scala
body: <p>This is what the code looks like  </p>
  
  <pre><code>import scala.xml.{Elem, Node, PCData}
  import scala.xml.transform.{RewriteRule, RuleTransformer}
  
  val doc: Elem = &lt;data&gt;
      &lt;level1&gt;
        &lt;Weekly&gt;
          &lt;Properties&gt;
            &lt;Property key="Sun"/&gt;
            &lt;Property key="Mon"/&gt;
            &lt;Property key="Tue"/&gt;
          &lt;/Properties&gt;
        &lt;/Weekly&gt;
      &lt;/level1&gt;
      &lt;level2&gt;
        &lt;Monthly&gt;
          &lt;Properties&gt;
            &lt;Property key="Jan"/&gt;
            &lt;Property key="Feb"/&gt;
            &lt;Property key="Mar"/&gt;
          &lt;/Properties&gt;
        &lt;/Monthly&gt;
      &lt;/level2&gt;
    &lt;/data&gt;
  
  final class traverseRule extends RewriteRule {
    override def transform(ns: Seq[Node]): Seq[Node] = ns match {
      case n: Node =&gt; println(n.label)
        n
  
    }
  }
  new RuleTransformer(new traverseRule()).transform(doc).head
  </code></pre>
  
  <p>What I get back is  </p>
  
  <pre><code>#PCDATA
  #PCDATA
  #PCDATA
  #PCDATA
  Property
  #PCDATA
  Property
  #PCDATA
  Property
  #PCDATA
  Properties
  #PCDATA
  Weekly
  #PCDATA
  level1
  #PCDATA
  #PCDATA
  #PCDATA
  #PCDATA
  Property
  #PCDATA
  Property
  #PCDATA
  Property
  #PCDATA
  Properties
  #PCDATA
  Monthly
  #PCDATA
  level2
  #PCDATA
  data
  </code></pre>
  
  <p><strong>Needed?</strong><br>
  I need the elements <code>data</code>, <code>level</code>, <code>Weekly</code> instead of <code>#PCDATA</code>. How can I achieve this?</p>
  
  <p>Thanks</p>