Created
January 29, 2009 13:14
-
-
Save bjartek/54533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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