Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fail to understand XML mystry

 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Bill
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic