This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 18541
    
    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:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XMLStreamReader to InputStream
 
Similar Threads
Can JAXB unmarshals child elements
MalformedURLException not understood
Skipping XML events using StAX
Reading XML In Form Of Key-Value Pair
Stax problem