11.1. XML Basics

The Extensible Markup Language (XML) was created to bring the advantages of the bloated Standard Generalized Markup Language (SGML) standard to smaller platforms such as Web browsers. XML retains the flexibility of its older sibling but has been redesigned for the Web with the ability to be easily transmitted via the Internet's architecture and displayed with less overhead.

The XML design strategy attempted to address the following points:

  • Form should follow function. In other words, the language should be flexible enough to encapsulate many types of data. Instead of shoehorning multiple forms of data into one structure, the structure should be able to change to adequately fit the data.

  • Documents should be easily understood by their content alone. The markup should be constructed in such a way that there is no doubt about the content it frames. XML documents are often referred to as self-describing because of this attribute.

  • Format should be separated from presentation. The markup language should represent the difference in pieces of data only and should make no attempt to describe how the data will be presented. For example, elements should be marked with tags such as <emphasis> instead of <b> (bold), leaving the presentation of the data (which should be emphasized, but not necessarily bold) to the platform using the data.

  • The language should be simple and easily parsed, with intrinsic error checking.

These attributes are evident in the goals stated in the W3C's ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.