Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java library to read write XML/ text file

Posted on 2010-09-23
6
Medium Priority
?
549 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 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
Independent Software Vendors: 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

618 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