Solved

Java library to read write XML/ text file

Posted on 2010-09-23
6
535 Views
Last Modified: 2013-11-23
Hello,

Looking for a library to read text files and write to XML (incl. XML to Text).

Downloaded JDOM to take care of creating  the XML.    Can Apache POI be used to read / write the text files?

Written unformatted data to text files in the past using FileReader/FileWriter, not sure how to control the formatting of the text file the same way ApachePOI supports writing to CSV etc.

Any other libraries available?

An example:

#----------------------------------------------------------------
"hr"              ! Units
14              ! Entries
"4"              ! No of Columns
#----------------------------------------------------------------

 ID           Parameter     LowBound      UpBound        
Para1     abc                10                     20            


Thanks.
0
Comment
Question by:AndyC1000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 33751510
use openCSV to read/write csv format. use JAXB to read write xml data, the advantage of using both is you can deal with bean in application represnting each record in CSV/XML
0
 
LVL 92

Expert Comment

by:objects
ID: 33751561
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
ID: 33751934
Another thing you should take a look at is Apache Camel
http://en.wikipedia.org/wiki/Apache_Camel
http://camel.apache.org/

Camel is a framework for allowing integration of a lot of remote systems. For this it has adapters to read and write a wide variety  of formats and to describe the flow of information from a source to a destination. Here's an example of how to read a CSV:
http://camel.apache.org/csv.html
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:AndyC1000
ID: 33766682
I need to read .xml and write to .txt (and vice versa).

I've looked into your links - is there an easy way to convert from .csv to .txt?
0
 

Author Comment

by:AndyC1000
ID: 33766787
Ignore the above post.

I've just worked out that I'll need to look into if the libraries write to tab seperated value file.
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33779162
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
spring jars download 1 67
Desingning Refactoring existing code 2 42
Glassfish admin console not working 1 85
batch vs regular insert in spring DAO 2 49
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

739 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