Solved

Java library to read write XML/ text file

Posted on 2010-09-23
6
526 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 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java JRE greater than 1.6 5 62
MySQL  on Tomcat 8 45
servlet filter example 37 62
Chrome and Firefox Java 5 31
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

773 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