At first, XML is not HTML. XML may look like HTML, based on the similarities of the tags and the general format of the data, but that’s where the similarity ends. While HTML is designed to describe display characteristics of Data on a Web Page to browsers, XML is designed to represent data structures. XML can be transformed into HTML using Extensible Style Sheet Transformations(XSLT).

XML is a metalanguage that allows user to define markup for their documents using tags. XML separates content and structure from formatting.

With XML you can :

Define data structures

Make these structures platform independent

Process XML defined data automatically

Define your own tags

With XML you cannot

Define how your data is shown. To show data, you need other techniques

XML does Not DO Anything
Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information.XML is Not a Replacement for HTMLXML is a complement to HTML

It is important to understand that XML is not a replacement for HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data.

XML is a software- and hardware-independent tool for carrying information.

XML is portable. Because XML is a simply text, it can obviously be moved between various platforms.Even more importantly, XML must conform to a specification defined by the World Wide Web Consortium (W3C) at http://www.w3.org/. This means that XML is a standard. When you send XML, it conforms to this standard; when some other application receives it, the XML still conforms to that standard. The receiving application can count on that.

By using XML, you get portable data. In fact, recently you may have heard the phrase “portable code, portable data” in reference to the combination of Java and XML. It’s a good saying, because it turns out (as not all marketing-type slogans do) to be true.

Interoperability

Remember that XML stands for the Extensible Markup Language. And it is so important in business interoperating. Consider HTML, the hypertext markup language, for example. HTML is a standard, it’s all text. So, in those respects, it’s just as portable as XML. In fact, clients usind diferents browsers on different operating systems can all view HTML more or less identically.

You couldn’t use HTML to represent a furniture manifest, or a billing invoice.
That’s because the standard tightly defines the allowed tags, the format, and everything else in HTML. This allows it to remain focused on presentation, which is both an advantage and a disadvantage.

However, XML says very little about the elements and content of a document. Instead, it focuses on the structure of the document; elements must begin and end, each attribute must have a single value, and so on. The content of the document and the elements and attributes used remain up to you. You can develop your own document formatting, content, and custom specifications for representing your data. And this allows interoperability. The various furniture chains can agree upon a certain set of constraints for XML, and then exchange data in those formats; they get all the advantages of XML (like portability), as well as the ability to apply their business knowledge to the data being exchanged to make it meaningful. A billing system can include a customized format appropriate for invoices, broadcast this format, and export and import invoices from other billing systems. XML’s extensibility makes it perfect for cross-application operation.

In next posts, I will explain how to do a XML Well-formed document.

This post was based on book JAVA and XML, O’Reilly chapter 1 and the references from W3C.