Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

xhtml - Scala and HTML parsing

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 scala.xml._

object NetParse {

   import java.net.{URLConnection, URL}
   import scala.xml._

   def netParse(sUrl: String): Elem = {
       var url = new URL(sUrl)
       var connect = url.openConnection

       XML.load(connect.getInputStream)
   }
}

Finally I found a solution! - Requires scala 2.7.7 or higher to work (2.7.0 has a fatal bug): How-to-use-TagSoup-with-Scala-XML

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...