Datasheet
9
Chapter 1 ✦ An Eagle’s Eye View of XML
XML also provides a client-side include mechanism that integrates data from multiple
sources and displays it as a single document. (In fact, it provides at least three differ-
ent ways of doing this, a source of some confusion.) The data can even be rearranged
on the fly. Parts of it can be shown or hidden depending on user actions. You’ll find
this extremely useful when you’re working with large information repositories like
relational databases.
The Life of an XML Document
XML is, at its root, a document format, a series of rules about what a document
looks like. There are two levels of conformity to the XML standard. The first is well-
formedness and the second is validity. Part I of this book shows you how to write
well-formed documents. Part II shows you how to write valid documents.
HTML is a document format that is designed for use on the Internet and inside web
browsers. XML can certainly be used for that, as this book demonstrates. However,
XML is far more broadly applicable. It can be used as a storage format for word
processors, as a data interchange format for different programs, as a means of
enforcing conformity with intranet templates, and as a way to preserve data in a
human-readable fashion.
However, like all data formats, XML needs programs and content before it’s useful.
It isn’t enough to just understand XML itself. That’s not much more than a specifica-
tion for what data should look like. You also need to know how XML documents are
edited, how processors read XML documents and pass the information they read
on to applications, and what these applications do with that data.
Editors
XML documents are most commonly created with an editor. This might be a basic
text editor, such as Notepad or vi, that doesn’t really understand XML at all. On the
other hand, it might be a completely WYSIWYG editor, such as Adobe FrameMaker,
that insulates you almost completely from the details of the underlying XML format.
Or it may be a structured editor, such as Visual XML (
http://www.pierlou.com/
visxml/
), that displays XML documents as trees. For the most part, the fancy editors
aren’t very useful as of yet, so this book concentrates on writing raw XML by hand
in a text editor.
Other programs can also create XML documents. For example, previous editions
of this book included several XML documents whose data came straight out of a
FileMaker database. In this case, the data was first entered into the FileMaker data-
base. Next, a FileMaker calculation field converted that data to XML. Finally, an
AppleScript program extracted the data from the database and wrote it as an XML
file. Similar processes can extract XML from MySQL, Oracle, and other databases
by using XML, Perl, Java, PHP, or any convenient language. In general, XML works
extremely well with databases.
03 549863 Ch01.qxd 1/28/04 9:46 AM Page 9