Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs a method for writing XML to an OutputStream #4286

Closed
scabug opened this issue Feb 23, 2011 · 2 comments
Closed

Needs a method for writing XML to an OutputStream #4286

scabug opened this issue Feb 23, 2011 · 2 comments

Comments

@scabug
Copy link

scabug commented Feb 23, 2011

= 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.)

@scabug
Copy link
Author

scabug commented Feb 23, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4286?orig=1
Reporter: Mikael Ståldal (mikaelstaldal)

@scabug
Copy link
Author

scabug commented Jul 17, 2015

@SethTisue said:
The scala-xml library is now community-maintained. Issues with it are now tracked at https://github.com/scala/scala-xml/issues instead of here in the Scala JIRA.

Interested community members: if you consider this issue significant, feel free to open a new issue for it on GitHub, with links in both directions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant