How do you load an HTML DOM document into Scala? The XML singleton had errors when trying to load the xmlns tags.
import java.net._
import java.io._
import s
I recommend Scala Scraper that lets you parse HTML elegantly like this:
// Parse elements from files, URLs or plain strings
val browser = JsoupBrowser()
val doc = browser.parseFile("core/src/test/resources/example.html")
val doc2 = browser.get("http://example.com")
val doc3 = browser.parseString("parse me
")
// Extract the text inside the element with id "header"
doc >> text("#header")
// Extract the elements inside #menu
val items = doc >> elementList("#menu span")
// From each item, extract all the text inside their elements
items.map(_ >> allText("a"))
Examples are taken from the Scala Scraper's readme.