File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes General Computing and the fly likes Why we need XML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Why we need XML? " Watch "Why we need XML? " New topic

Why we need XML?

ssiva kumar

Joined: May 29, 2006
Posts: 9

Why we need XML.?(we have ascii file format is a gentral format, to access all plateform,why not we didn't follow.?)

like XML:

<name> java</name>

flat files:

contact name:java age:25

i feel flat file is small and easy .....why we didn't use it.........?
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
A great percentage of things for which XML is used could indeed be done just as easily or better using a fixed format textfile. This is in no small part a leftover from 5+ years ago when "XML" was a major buzzword that was massively hyped and everyone scrambled over eachother to use it whereever they could think of it. Being able to say you were using XML made your product instantly desirable to managers everywhere, in fact many IT departments were ordered to implement XML in every project by CEOs who wanted their companies to be seen as "modern" or "trendsetters".
This led to XML configuration files where standard Windows ini files or Java properties files would have been far easier to use and far more efficient, and that attitude is in part still with us to this day.

The advantage of XML lies mainly in being (if properly constructed) easier to read, being more or less self-documenting.
When having hierarchical data structures (multiple children for a record) which aren't easily implemented using fixedformat records without serious data duplication XML comes into its own though.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

As Jeroen mentioned, if you have to represent a complex hierarchy of typed objects with lots of nesting, XML is the way to go.

It's also an attempt to standardize data exchange.

It is bulky though. A lot of applications would be better served with simple delimited text or JSON.

Anyway, this is not a servlet question so moving to General Computing.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Why we need XML?
It's not a secret anymore!