File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes JAVA API to Read XML File? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JAVA API to Read XML File?" Watch "JAVA API to Read XML File?" New topic

JAVA API to Read XML File?

Deepak Chopra
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Hi All,

I want to read XML files using J2SE, I am confused whether should I treat the XML as text file and start reading OR Is there any JAVA API that can help me in that?

Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Petrus Pelser
Ranch Hand

Joined: Feb 20, 2006
Posts: 132
You can use either SAX or DOM.
Nitesh Kant

Joined: Feb 25, 2007
Posts: 1638

javax.xml package contains the related api. Googling "java xml parsers" will give you useful results.

apigee, a better way to API!
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
this link may give you some idea...


Rob Spoor

Joined: Oct 27, 2005
Posts: 20193

JDOM is a well-known DOM library.

How To Ask Questions How To Answer Questions
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
I actually prefer

Both DOM and SAX are programming language agnostic APIs, which make them kind of awkward to use from a Java perspective (for example, they don't use Java collections were it would be appropriate).

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: JAVA API to Read XML File?
It's not a secret anymore!