?
Solved

Java library to read write XML/ text file

Posted on 2010-09-23
6
Medium Priority
?
553 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
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 2000 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
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.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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
Course of the Month15 days, 8 hours left to enroll

850 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