This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes working with java with XML 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 "working with java with XML" Watch "working with java with XML" New topic

working with java with XML

Chaveen Ekanayake

Joined: Jun 01, 2008
Posts: 15
I ve heard that XML is easier and convenient than database connection for smaller programs. But I dont know how to store, edit, delete, data in a XML file. Please help me
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Personally, I think that XML is a poor substitute for a database for any size program.

[Asking smart questions] [About Bear] [Books by Bear]
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 378
Chaveen, what exactly is your requirement?

As Bear says XML is not a substitute for a database.
arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3371
XML is good for exchanging data between two systems. If you really need to store in an XML, look at DOM Parser, JAXP, JiBX etc.

[] | [Java job hunting know how] | [Java resumes]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
There are plenty of XML and Java tutorials.

Harold has placed this massive and very complete book on line for your reference. It is loaded with examples. You will also need to get familiar with the standard Java library JavaDocs for XML related packages.

Chaveen Ekanayake

Joined: Jun 01, 2008
Posts: 15
I am designing a chat program. I thought a database is too much for a chat program. Is that wrong?? should I use sql
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I wouldn't think that a chat facility needs any long term storage. If it's the messages that you want to archive, you might consider plaintext files (not XML), since they never change.

Make sure the users of the chat know that their conversations are being stored; that might make it a non-starter for quite a few people.
[ September 15, 2008: Message edited by: Ulf Dittmer ]
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 378
Have you had a look at XMPP (also called Jabber)?

XMPP is an XML protocol for Messaging and Prescence (XMPP = Extensible Messaging and Presence Protocol)

There should be free and open source client libraries and chat servers available for the XMPP protocol. Check here for one example.

On ways to parse XML, you might want to look at StAX too to see whether it suits your requirements.
I agree. Here's the link:
subject: working with java with XML
It's not a secret anymore!