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

add support for connections to write_xml #157

Closed
lbartnik opened this issue Dec 19, 2016 · 4 comments
Closed

add support for connections to write_xml #157

lbartnik opened this issue Dec 19, 2016 · 4 comments

Comments

@lbartnik
Copy link

@lbartnik lbartnik commented Dec 19, 2016

write_xml accepts a file path as its second parameter. It could also accept a connection or even a broader list of outputs similar to cat()

@jimhester
Copy link
Member

@jimhester jimhester commented Dec 19, 2016

Sure we would probably accept a pull request implementing this, but I don't think we are going to implement it ourselves. as.character() will get you the text representation in memory if that is what you are after.

@lbartnik
Copy link
Author

@lbartnik lbartnik commented Dec 19, 2016

Interesting... I suppose it won't do formatting like write_xml(..., format = TRUE) would? I added this bc Hadley asked me. There's a JUnit reporter in testthat that needs to write to stdout() and currently I need to write to a tempfile() before passing to the final stream.

@hadley
Copy link
Member

@hadley hadley commented Dec 19, 2016

@jimhester we won't do it for this release, but it might be worthwhile to do next time, just to get more experience writing to connections (which ideally we should support anytime you can pass a filename)

@jimhester
Copy link
Member

@jimhester jimhester commented Dec 20, 2016

@lbartnik As of 0676f71 you can use as.character(..., format = TRUE) and get equivalent formatting to write_xml().

jimhester added a commit to jimhester/xml2 that referenced this issue Dec 20, 2016
This provides full connection support for XML and HTML output using the
xmlSave API (http://xmlsoft.org/html/libxml-xmlsave.html). It also
refactors the file output functions to use the xmlSave API as well,
which provides more formatting and encoding options than the previous
APIs.

Closes r-lib#157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants