If you are using Scala, scala.io.Source is your good friend. import scala.io.Source import scala.xml.XML ...
stackoverflow.com