XML is a markup language for documents containing structured information. At first glance, XML is similar to hypertext markup language (HTML); with both, you mark up document content with descriptive tags surrounded by angle brackets. In XML, documents commonly include the following elements:
Comments | <!-- --> |
Headers | <?xml version = "1.0"?> |
Start tags | <record> |
End tags | </record> |
Elements can have children, which can have children, and so on. The main difference between HTML and XML, however, is that in HTML, the markup defines hypertext structure or display formatting. In XML, the markup defines the document content itself.
Unlike HTML, XML contains no predefined tag set or preconceived semantics for the markup. Rather, XML lets you define tags and the structural relationships between them based on the content of your document. For example, you may define tags called <lender>, <borrower>, and <due-date>. Because XML documents contain information about themselves, they are an excellent vehicle for transporting data from one location to another.