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