XML: Structuring Data for the Web: An Introduction
May 3rd 1998
Enter XML
Extensible Markup Language (XML)
is a non-mutually exclusive alternative to
HTML
and the aforementioned
technologies.
"XML
is a
language
for creating markup languages
that describe data,"
wrote
Mike Edwards of Microsoft. In contrast to HTML which describes document
structure and visual presentation, XML describes data in a human
readable format with no indication of how the data is to be displayed.
It is a database-neutral and device-neutral format; data marked up in
XML can be targeted to different devices using
Extensible Style Language
(XSL), the subject of a future WDVL article.
Since XML is truly extensible, rather than a fixed set of elements
like HTML, use of XML will eventually eliminate the need for browser
developers and middleware tools to add special HTML tags (extensions).
How is this possible? Well, XML is a meta language used to define
other domain- or industry-specific languages. To construct your own
XML language (also called a "vocabulary"), you supply a
specific
Document Type Definition (DTD),
which is essentially a
context-free
grammar like the Extended BNF (Backus Naur Form) used to
describe computer languages. In other words, a DTD provides the
rules that define the elements and structure of your new language.
In our
employee record example,
our DTD would include a rule that states that the
<NAME> element consists of three other elements
called <FIRST>, <MIDDLE>,
and <LAST>, in that order. The rule would also
indicate if any of the nested elements is optional, can be repeated,
and/or has a default value. [The exact details of how you would
develop your vocabulary by writing your DTD will be the subject of
another WDVL article.] It is important to understand that any
browser (or application) with an XML parser could interpret our
employee document instance by "learning" the rules
defined by the DTD.
[footnote]
The new elements
of this Employee Markup Language did not require browser
extensions or a committee with representatives from different
companies to decide on what they should be. XML gives you the
freedom and power to create your own language.
For those familiar with
Standard
Generalized Markup Language (SGML),
XML is less complex than SGML but more complex than HTML. It has
been said that XML provides 80% of the benefit of SGML with 20%
of the effort.
Footnote: Strictly speaking, a DTD is not
absolutely necessary. XML parsers can infer the structural rules
of the language (including ones they have never encountered
before) from the context of the elements in the particular
document instance, especially in cases such as our trivial
example. However, in a more complex XML vocabulary,
the presence of a DTD is very likely.
XML: Structuring Data for the Web: An Introduction
XML: Structuring Data for the Web: An Introduction
XML: Structuring Data for the Web: An Introduction
|