Skip to content

Instantly share code, notes, and snippets.

@bro1
Created February 6, 2013 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bro1/4719831 to your computer and use it in GitHub Desktop.
Save bro1/4719831 to your computer and use it in GitHub Desktop.
Scala save pretty XML
val myXML = <top><test></test></top>
val prettyPrinter = new scala.xml.PrettyPrinter(80, 2)
val formattedString = prettyPrinter.format(myXML)
val fos = new FileOutputStream("outfile.xml")
val fps = new PrintWriter(fos);
fps.write(formattedString)
fps.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment