title: Parse HTML in Scala
body: <p>Task: HTML - Parser in Scala. Im pretty new to scala.</p>
  
  <p>So far: I have written a little Parser in Scala to parse a random html document.</p>
  
  <pre><code>import scala.xml.Elem
  import scala.xml.Node
  import scala.collection.mutable.Queue
  import scala.xml.Text
  import scala.xml.PrettyPrinter
  
  object Reader {
    def loadXML = {
      val parserFactory = new org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl
      val parser = parserFactory.newSAXParser()
      val source = new org.xml.sax.InputSource("http://www.randomurl.com")
      val adapter = new scala.xml.parsing.NoBindingFactoryAdapter
      val feed = adapter.loadXML(source, parser)
      feed
    }
  
    def proc(node: Node): String =
      node match {
        case &lt;body&gt;{ txt }&lt;/body&gt; =&gt; "Partial content: " + txt
        case _ =&gt; "grmpf"
      }
  
    def main(args: Array[String]): Unit = {
      val content = Reader.loadXML
      Console.println(content)
      Console.println(proc(content))
  
    }
  }
  </code></pre>
  
  <ol>
  <li><p>The problem is that the "proc" does not work. Basically, I would like to get exactly the content of one node. Or is there another way to achieve that without matching?</p></li>
  <li><p>Does the "feed" in the loadxml-function give me back the right format for parsing or is there a better way to achieve that? Feed gives me back the root node, right?</p></li>
  </ol>
  
  <p>Thanks in advance</p>