I pull some markup from the url and return one scala.xml.Node, for example ...
def doGoogleSearch(query:String) : scala.xml.Node = {
val tmpUrl = "http://www.google.com?q="
val tmp = tmpUrl.concat(query)
val url = new URL(tmp)
val conn = url.openConnection
val sorce:InputSource = new InputSource
val neo = new TagSoupFactoryAdapter
val input = conn.getInputStream
sorce.setByteStream(input)
val markup = neo.loadXML(sorce)
input.close
return markup
}
Next, I want to scroll through each child element inside the markup, and what I have so far seems to only print 2x (still this is a huge amount of html returned). What am I missing here?
def loopThroughChildren(markup:scala.xml.Node) : String = {
for (i <- 0 until markup.child.length) {
//println(??
}
return ""
}
Thank you in advance!
source
share