Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XMLStreamReader to InputStream

 
Arundhathi Menon
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Clapham
Sheriff
Posts: 21140
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
Android Chrome IntelliJ IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic