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 fail to understand XML mystry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "fail to understand XML mystry" Watch "fail to understand XML mystry" New topic

fail to understand XML mystry

Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199

As per my bst knowlwdge, html deals with presentation layout where as xml take care of the data to be displayed.
But i just fail to understand is why do we need xml to maintain data? We can use one of various patterns available (Data Transfer Object, Value Object)to store data, just as we do in MVC.
Why do we actually need xml?
Where else should we use xml?
Moreover when we talk about xml being plateform independent, is HTMl+jsp not a plateform independent combination

Kindly Clarify
Thanks a lot in advance

~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
I feel qualified to answer this since I use XML extensively to maintain sets of questions for mock exams.
1. XML is easy to edit (how do you edit a JDO?)
2. XML is easy to transform
3. With XML you can add new fields and functions without breaking old programs
4. XML provides verification facilities (DTD, Schema, etc)
5. XML documents are easy to explain to other people, especially when your data has a deep hierarchy. (compare a relational DB)
6. In MVC - XML documents make a great way to store the M and I frequently have a model class that holds a DOM in memory.

Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
My company uses XML for portability.
As log as you stick to communication between Java applications, it may be ok to consider Java "value objects", passed using RMI or java Object Streams.
However, our current situation also requires communication between C++ dot Net applications, Java applications, MainFrame/Natural systems, and more. So you need a data format that everyone agrees upon, and everyone has a reasonable API for writing/reading. I wish I could make them all implement (or download) some API for manipulating the Java serialization format, but XML was a more popular choice.
On the plus side, it's easy, acceptable for most programmers (Natural people had to write some adapters), and very easy to debug & log.
On the minus side, it's not a very compact format. And I'm still looking for a good serialization tool (that would, for example, maintain references & relationships). I believe there are some reasonably good tools. Still waiting for a reply on a question I've posted on the subject.
I agree. Here's the link:
subject: fail to understand XML mystry
It's not a secret anymore!