Created
November 15, 2012 12:54
-
-
Save ryoco/4078505 to your computer and use it in GitHub Desktop.
Unparsed test
This file contains 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 scala.xml.parsing._ | |
import scala.xml._ | |
import scala.io._ | |
val src = Source.fromString("<html><head /><body><script>var foo = \"fooooooo\";</script></body></html>") | |
val cpa = ConstructingParser.fromSource(src, false); | |
val doc = cpa.document(); | |
val ppr = new scala.xml.PrettyPrinter(80,2); | |
val ele = doc.docElem; | |
val out = ppr.format(ele); | |
====result==== | |
out: String = | |
<html> | |
<head></head> | |
<body> | |
<script>var foo = "fooooooo";</script> | |
</body> | |
</html> |
This file contains 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
val src = Source.fromString("<html><head /><body><script>var foo = \"fooooooo\";</script></body></html>") | |
val str = src.mkString | |
val unparsed = Unparsed(str).toList.head | |
val ppr = new scala.xml.PrettyPrinter(80,2); | |
val out = ppr.format(unparsed); | |
====result==== | |
out: String = <html><head /><body><script>var foo = "fooooooo";</script></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment