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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Xml in java" Watch "Xml in java" New topic

Xml in java

shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I have to read datas from xml which will serve as an input for my applet..How can i do it?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The standard API for handling XML in Java is called JAXP, and you can find some introductory articles in the XML FAQ.

The details on how to access the XML data differ a bit depending on where the XML file originates - the client or the server.

Once you have the XML, there are various ways to process them - mainly SAX, DOM and XPath. Which is best depends on how the XML looks like, and what you intend to do with it.
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
Thanks for your reply...I have to start from the scratch..So, can you say some good tutorial so that i can learn from the begining...
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
I'd rather use Dom4J - it's a much nicer API:

Unless you really have to read *huge* documents - then you will probably *have* to use SAX...

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
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
You can also use the JDOM API ...

Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Note that the original post mentions input to an applet, therefore he should stick with the standard java library. JDOM or DOM4J would require that the client have those libraries installed, a useless complexity.

chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
Hi Shalini,

I am also looking for the same solution but thing is in my case Server is the one from which my flow will be handling XML and using in EJB, so if you have found something easily adoptable please give your inputs.


With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Xml in java
It's not a secret anymore!