Appendix A. Introduction to XML
XML is the most popular way to store data and exchange information over the Internet. Since so many languages can read and write XML files, use XML when you want to share data among different applications and platforms. One of XML’s greatest features is its ubiquity.
XML also benefits from being easy to learn. Since XML looks like
HTML, web developers are familiar with its tag-based syntax. However,
XML is not HTML. HTML has a fixed set of elements:
<h1>, etc. With XML, you have the
flexibility to use whatever element names best represent your data.
When choosing how to represent data, developers seem to fall into one of two camps. Some people think of XML as a record format, similar to comma-separated files. But instead of separating entries with newlines and fields with commas, XML provides richer classification options.
Other developers view XML as a document specification format. The
PHP Manual (http://www.php.net/manual) is produced from
XML files. The PHP Documentation Team’s documents
use tags such as
<example>. This allows them to release the
manual in multiple formats, including two versions of HTML, Windows
CHM help files, and PDF.
Comparing HTML and XML
HTML and XML are siblings: they are both children of Standard Generalized Markup Language (SGML). Therefore, an XML document looks somewhat like an HTML page. Example A-1 is an XML document that represents a basic address book.
Example A-1. Simple ...