• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Excel from xml String

 
Shiva Shankar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are calling SOAP Webservice which will execute DB query and returns the result as XML data.

Now XML data is stored in java.lang.String.

Can any one help me to provide sample code to generate excel file from the String which contains XML data.

Thanks
Shiva
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the SAX or DOM APIs to extract the data from the XML string, and then use the Apache POI library to create an Excel file.
 
Shiva Shankar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application is getting very large response around 3-4 MB sometimes.
Is it feasible to use SAX or DOM parser?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on what you're trying to achieve! DOM parsers are typically used when you processing needs to know about the relationships of your XML structure (e.g. You have to navigate parent/child relationships). I tend to use SAX when I'm going for a 'smash and grab' operation, e.g. Just getting all of nodes called <foobar> and seeing value value they hold
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic