|
What Is “Markup” and Why Do We Use It?Bog'liq Ceponkus, Hoodbhoy - Applied XML - Toolkit for ProgrammersWhat Is “Markup” and Why Do We Use It?
When we were younger, our English teachers used a lot of red ink on our essays to
clearly delineate where we had made spelling and grammatical mistakes.
Markup
refers
to the instructions written on top of our essay by the teacher, including things such as
“you’ll never be a writer.” Actually the term was first used in the paper printing industry
when copy editors would write in the margin of paper telling the printer where to use a
particular typeface (for example, “use bold print” or “drop cap here”). The word
processing industry has largely been a spin-off of the paper printing industry and so the
instructions for telling a computer when to use bold or underline styles were also called
markup.
Today we’ve extended the concept of markup to encode instructions that can tell an
application what to do with information chunks. Think of markup as street signs on a
road. You see a stop sign, and you stop. You see a detour, and you take a detour. The
road is your raw information, and the street signs are the markup you need to navigate
your way around.
Keeping this analogy in mind, XML is a standard method of putting up road signs that
help you navigate your way through the sheer magnitude of information on the Web.
Is XML Like HTML?
XML is sort of like HTML, but not quite. Both HTML (HyperText Markup Language) and
XML come from the same parent technology: SGML (Standard Generalized Markup
Language). SGML is an older technology that was heavily deployed across mainframes
and so-called “legacy systems” for financial institutions, defense systems, government
information systems, to name a few. SGML remains a very powerful technology, but it is
not for everyone—in its purest form, it’s like swatting a fly with a bazooka.
In deference to those of us who wanted to do only some of the things that SGML could
do, such as displaying formatted text without having to learn the entire complicated
language, HTML was invented. HTML had to be simple and easy so that everyone could
use it on a variety of computer platforms (for example, PCs, Unix machines, and
mainframes). Tough order, but HTML delivered and today is ubiquitous over the Web.
As great as it is for displaying information, HTML is not the best way to represent
information. Enter XML: a universal method for representing information. XML is a
complementary technology
to HTML, not a replacement of it.
For Example…
Let’s take, for example, a clip of HTML that’s being used to represent information from an
address book. To keep it simple, let’s say this address book only contains information
about names, phone numbers, and addresses. Our address book clip could look like this:
|
| |