Example 1-1. An XML document
<?xml version="1.0"?>
<product barcode="2394287410">
<manufacturer>Verbatim</manufacturer>
<name>DataLife MF 2HD</name>
<quantity>10</quantity>
<size>3.5"</size>
<color>black</color>
<description>floppy disks</description>
</product>
This document is text and might well be stored in a text file. You
can edit this file with any standard text editor such as BBEdit,
jEdit, UltraEdit, Emacs, or vi. You do not need a special XML editor.
Indeed, we find most general-purpose XML editors to be far more
trouble than they're worth and much harder to use
than simply editing documents in a text editor.
The application that receives data from the parser may be:
-
A web browser such as Netscape Navigator or Internet Explorer that
displays the document to a reader
-
A word processor such as StarOffice Writer that loads the XML
document for editing
-
A database such as Microsoft SQL Server that stores the XML data in a
new record
-
A drawing program such as Adobe Illustrator that interprets the XML
as two-dimensional coordinates for the contents of a picture
-
A spreadsheet such as Gnumeric that parses the XML to find numbers
and functions used in a calculation
-
A personal finance program such as Microsoft Money that sees the XML
as a bank statement
-
A syndication program that reads the XML document and extracts the
headlines for today's news
-
A program that you yourself wrote in Java, C, Python or some other
language that does exactly what you want it to do
-
Almost anything else
XML is an extremely flexible format for data. It
is used for all of this and a lot more. These are real examples. In
theory, any data that can be stored in a computer can be stored in
XML format. In practice, XML is suitable for storing and exchanging
any data that can plausibly be encoded as text. It's
only really unsuitable for multimedia data such as photographs,
recorded sound, video, and other very large bit sequences.
 |  |  |
1.2. Portable Data |  | 1.4. The Evolution of XML |