You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= problem =
There is no simple way to write a scala.xml.Node to an java.io.OutputStream.
= analysis =
Quite often you have an existing Java library or framework which gives you an java.io.OutputStream which you are supposed to write to.
Doing so from Scala when you have XML data in a scala.xml.Node is currently non-trivial if you want to get Unicode encoding right.
You could wrap the OutputStream with an OutputStreamWriter and use the current XML.write method, but then you need to specify the same encoding twice, and remember to flush the OutputStreamWriter.
= enhancement recommendation =
Add a method to scala.xml.XML with a signature like this:
= problem =
There is no simple way to write a scala.xml.Node to an java.io.OutputStream.
= analysis =
Quite often you have an existing Java library or framework which gives you an java.io.OutputStream which you are supposed to write to.
Doing so from Scala when you have XML data in a scala.xml.Node is currently non-trivial if you want to get Unicode encoding right.
You could wrap the OutputStream with an OutputStreamWriter and use the current XML.write method, but then you need to specify the same encoding twice, and remember to flush the OutputStreamWriter.
= enhancement recommendation =
Add a method to scala.xml.XML with a signature like this:
def write(os: java.io.OutputStream, node: Node, enc: String, xmlDecl: Boolean, doctype: DocType) : Unit
(It could be named "save" as well.)
The text was updated successfully, but these errors were encountered: