Compare XML with HTML.

Q17. Compare XML with HTML with respect to the following two points:

  1. Document structure
  2. Tags


  1. Document Structure: The data of both XML and HTML documents are represented in a tree-like structure. However, in the case of XML documents or data, the structure is defined by DTD or schemas. This ensures that the data is organized according to DTD rules. HTML does not have such facility to define the data and document structure.
  2. Tags: Tags are used in both XML and HTML. However, there is one main difference between the two. HTML provides a set of predefined tags, which means that the user cannot extend tag capability in HTML. In other words, the user cannot create his/her own tags. However, in the case of XML, the user can create his/her own tags and use them according to his/her requirements.