aspose file tools*
The moose likes XML and Related Technologies and the fly likes XMLStreamReader to InputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XMLStreamReader to InputStream" Watch "XMLStreamReader to InputStream" New topic
Author

XMLStreamReader to InputStream

Arundhathi Menon
Ranch Hand

Joined: Jan 14, 2004
Posts: 113
Hi,

My webservice call returns an XMLStreamReader. I would like to know how to extract just the string representation of the whole xml so that I can dump it in the DB for future processing.

I short , converting the XMLStreamReader's content into an outputstream is what I need.

Can someone help?

Thanks in advance

Menon


SCJP , SCWCD , SCBCD , SCDJWS
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18887
    
    8

Then you need an identity Transformer. When you call its transform(Source, Result) method the Source should be a StAXSource which wraps that XMLStreamReader, and the Result should be a StreamResult which wraps a StringWriter.
Robert Papp
Greenhorn

Joined: Feb 14, 2014
Posts: 1
Paul Clapham wrote:Then you need an identity Transformer. When you call its transform(Source, Result) method the Source should be a StAXSource which wraps that XMLStreamReader, and the Result should be a StreamResult which wraps a StringWriter.

I think what he meant was:
 
jQuery in Action, 2nd edition
 
subject: XMLStreamReader to InputStream