This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Excel from xml String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Excel from xml String" Watch "Excel from xml String" New topic
Author

Excel from xml String

Shiva Shankar
Ranch Hand

Joined: Dec 07, 2006
Posts: 31
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

Joined: Mar 22, 2005
Posts: 42956
    
  73
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

Joined: Dec 07, 2006
Posts: 31
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

Joined: Jun 24, 2003
Posts: 3275
    
    5

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


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Excel from xml String
 
It's not a secret anymore!