What is the difference between HTML and XML?

 Posted by Niladri.Biswas on 12/9/2012 | Category: Others Interview questions | Views: 3040 | Points: 40

1) XML was designed to describe data and to focus on what data is.HTML was designed to display data and to focus on how data looks

2) XML tags are not predefined. We must "invent" our own tags. The tags used to mark up HTML documents and the structure of HTML documents are predefined. (like <b>, <h1>, etc.).

3) XML can be used to Create new Languages.XML is the mother of WAP( Wireless Application Protocol) and WML (The Wireless Markup Language).HTML cannot do so.

4) All XML elements must have a closing tag.In HTML some elements do not have to have a closing tag. The following code is legal in HTML: <p>This is a paragraph
In XML all elements must have a closing tag, like this: <p>This is a paragraph</p>

5) Unlike HTML, XML tags are case sensitive.

6) Improper nesting of tags makes no sense to XML.In HTML some elements can be improperly nested within each other like this:<b><i>This text is bold and italic</b></i>

In XML all elements must be properly nested within each other like this: <bold><italic> This text is bold and italic </italic></bold>

7) With XML, white space is preserved.With XML, the white space in the document is not truncated.This is unlike HTML. With HTML, a sentence like this:
Hello              my name is John,
will be displayed like this:
Hello my name is John,
because HTML strips off the white space

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response