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

Comments

Projects
None yet
3 participants
@lbartnik
Copy link

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()

@lbartnik lbartnik referenced this issue Dec 19, 2016

Merged

Junit reporter #481

@jimhester

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

Connection support for writing XML and HTML
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
You can’t perform that action at this time.