Skip to content

Instantly share code, notes, and snippets.

@bjartek
Created January 29, 2009 13:14
Show Gist options
  • Save bjartek/54533 to your computer and use it in GitHub Desktop.
Save bjartek/54533 to your computer and use it in GitHub Desktop.
import _root_.java.net.{URLConnection, URL}
import scala.xml._
class PlanetScala {
def feed():Elem = {
val url = new URL("http://www.drmaciver.com/planetscala/atom.xml")
val conn = url.openConnection
val atom = XML.load(conn.getInputStream)
atom
}
def show() =
for(entry <- feed \ "entry";
title <- entry \ "title";
if title.text != "";
link <- entry \ "link") yield
<li><a href={link.attribute("href").get.text}>{title.text}</a></li>
def list():Elem = {
<ul>{ show.slice(0,10) }</ul>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment