Chapter 30. Introduction to XML

XML (Extensible Markup Language) is a document encoding or markup standard that has been approved by the World Wide Web Consortium. XML is not so much a language in itself (like HTML), but rather a set of rules for creating other markup languages. It is a metalanguage used to define other languages. If this all sounds highfalutin to you, think of it this way: XML provides a way for you to make up your own tags! This is a powerful new tool for exchanging meaningful information.

Consider these two examples, the first using standard HTML markup, the second using a markup language written according to the rules of XML:

<p>Bobby Five</p>
<p>4456</p>
<p>111.32</p>

<name>Bobby Five</name>
<accountNumber>4456</accountNumber>
<balance>111.32</balance>

The XML file tells a lot more about the information contained in the tags. With meaningful markup tags, elements on the page aren’t just headings and paragraphs: they become useful data. So while this information can be displayed on a page, it can just as easily be stored in a database (which is a common use of XML-formatted information). Using XML, various communities—business groups, scientists, trade associations—may now define a markup language to suit their particular needs for information exchange and processing over the Web.

XML can also be used to indicate the structure of specialized information that could not be represented using HTML alone, such as musical notation and mathematical formulas. Chapter ...

Get Web Design in a Nutshell, 2nd Edition 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.