The scala.xml.XML.write method supports outputting an XML node sequence to a java.io.Writer, for example in a servlet response. However, it doesn't seem to have an option to output the XML in pretty printed format. Is there any Scala standard library function to pretty print an XML node sequence to a java.io.Writer?
Note: scala.xml.PrettyPrinter does not seem to be the answer because it only returns a string. The pretty printer would need to output directly to a java.io.Writer.
I wrote a PrettyPrinter that can directly write to a given file: XMLPrettyPrinter
I use it in production.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With