What is a Document?

An XML document is a set of user defined elements(tags), that are used to define and describe structure of a document. Using these elements we can define “who contain what”.

XML Document
Remember, unlike HTML, XML does not have any predefined tags (elements) to use! Yes that’s true there is no predefined tags in XML to use, instead XML authors can “invent” their own tag to create XMLdocument. That is the liberty of XML, it gives us the power & flexibility to create our own tags to define and describe the structure of our document. With HTML we have no choice, other then to use the already defined tags. In this scenario we don’t have that kind of freedom, because meaning of tags is already defined. One more thing HTML does not know anything about data; presentation of data performed through HTML.
With XML we can define the structure of our document.
For example, we want to create an email, and then the structure of the same will as follows:
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
       <sender_name>XYZ Kumar</sender_name>
      <sender_email_id>[email protected]</sender_email_id>
      <recipient_email_id>[email protected]</recipient_email_id>
<subject>Hello! how r U</subject>
      <message_header>Hello dear</message_header>
      <message_body_text>Hello this is Ravish, how are you dear</message_body_text>
      <message_footer>bye!, take care</message_footer>
Scroll to Top