Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Conversion of XML to CSV format in Java

Posted on 2001-06-14
8
Medium Priority
?
492 Views
Last Modified: 2012-06-27
Hi,
A Java application of mine requires the exporting of data in XML format to the CSV (Excel sheet) format. I could download the code that does the reverse (CSV to XML), from the net, but could not get this. But if one of you has the java code for converting a xml string to a csv file, or if you know of a place in the net which has such an utility, please let me know.
Thanks in advance,
Regards,
KK
0
Comment
Question by:jkrishnak
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Expert Comment

by:jerelw
ID: 6263048
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="csv.xsl"?>
<COLLECTION>
  <BOOK>
    <TITLE>Cosmos</TITLE>
    <AUTHOR>Carl Sagan</AUTHOR>
    <PUBLISHER>Ballantine Books</PUBLISHER>
 </BOOK>
 <BOOK>
    <TITLE>Catwings</TITLE>
    <AUTHOR>Ursula K. Le Guin</AUTHOR>
    <PUBLISHER>Scholastic</PUBLISHER>
 </BOOK>
</COLLECTION>

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="/COLLECTION/BOOK">
<xsl:value-of select="TITLE"/>,<xsl:value-of select="AUTHOR"/>,<xsl:value-of select="PUBLISHER"/>&#13;&#10;
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
0
 
LVL 1

Accepted Solution

by:
vijayneema earned 400 total points
ID: 6297292
you can use XSL to convert XML into text and CSV format

example

<xsl:for-each select="/LookUps/LookUp">
<xsl:value-of select="field1"/>,
<xsl:value-of select="field1"/>,
<xsl:value-of select="field1"/>
<br>
</xsl:for-each>      
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6401136
This question was LOCKED with a PROPOSED ANSWER and awaits your decision today, no participating expert(s) has (have) been awarded for their help here.
If the Proposed Answer helped you, please accept it and award that expert.  If it did not
help you, please reject it and add comments as to status and what else is needed.

If you wish to award multiple experts, just comment here with detail.

Your response in finalizing this old question is appreciated.

Moondancer
Community Support Moderator @ Experts Exchange
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:jerelw
ID: 6402812
?,...'<br>' is HTML.

0
 
LVL 4

Expert Comment

by:marper
ID: 6506744
vijayneema,
could you tell me please where you got that code that convert a csv file to an xml file ?
0
 
LVL 1

Expert Comment

by:vijayneema
ID: 6508857
marper,

you are wrong
this code is to convert
xml to CSV string only.

0
 
LVL 4

Expert Comment

by:marper
ID: 6508886
well, OK
where can I get that code ?
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6617567
Finalized by:
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month10 days, 17 hours left to enroll

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question