Markup Languages

Markup languages are all about describing the form of the document—that is, the way the content of the document should be interpreted. The markup language that most people are familiar with today, of course, is HTML, which you use to create standard Web pages. Here's a sample HTML page:

<HTML>
    <HEAD>
        <TITLE>Hello From HTML</TITLE>
    </HEAD>
    <BODY>
        <CENTER>
            <H1>
               Hello From HTML
            </H1>
        </CENTER>
        Welcome to the wild and woolly world of HTML.
    </BODY>
</HTML>

You can see the results of this HTML in Figure 1.1 in Netscape Navigator. Note that the HTML markup in this page—that is, tags such as <HEAD>, <CENTER>, <H1>, and so on—is there to give directions to the browser. That's what markup does; it specifies directions on the way the content is to be interpreted.

Figure 1.1. An HTML page in a browser.


There is a real relationship between HTML and XML; both are based on Standard Generalized Markup Language (SGML). As its name implies, SGML is a very general markup language, with enormous capabilities. Because of the large number of things you can do with SGML, however, it can be very difficult to learn, and it hasn't caught on in general use. XML is actually an easier-to-use subset of SGML (and technically speaking, HTML is called an application of SGML). You can read more about the relationship between SGML and XML at http://www.w3.org/TR/NOTE-sgml-xml.

When you think of markup in terms of specifying how the content of a document is to be handled, it's easy to see that many kinds of markup languages abound already. For example, if you use a word processor to save a document in rich text format (RTF), you'll find all kinds of markup codes embedded in the document. Here's an example; in this case, I've just created an RTF file with the letters "abc" underlined and in bold using Microsoft Word. Try searching for the actual text (hint: it's near the very end):

{
tf1ansiansicpg1252uc1 deff0deflang1033
deflangfe1033{fonttbl{f0fromanfcharset0fprq2{*panose
02020603050405020304}Times New Roman;}}{colortbl;
ed0
green0lue0;
ed0green0lue255;
ed0green255lue255;
red0green255lue0;
ed255green0lue255;
ed255green0
blue0;
ed255green255lue0;
ed255green255lue255;
ed0
green0lue128;
ed0green128lue128;
ed0green128lue0;
red128green0lue128;
ed128green0lue0;
ed128green128
blue0;
ed128green128lue128;
ed192green192lue192;}
{stylesheet{widctlparadjustright fs20cgrid snext0 Normal;}
{*cs10 additive Default Paragraph Font;}}{info{	itle  }
{author Steven Holzner}{operator Steven Holzner}{creatim
yr2000modyhrmin}{
evtimyr2000mo4dy17hr13min55}
{version1}{edmins1}{
ofpages1}{
ofwords0}{
ofchars1}
{*company SteveCo}{
ofcharsws1}{vern89}}widowctrlftnbj
aenddocformshadeviewkind4viewscale100pgbrdrheadpgbrdrfoot
fet0sectd psz1linex0endnheresectdefaultcl {*pnseclvl1
pnucrmpnstart1pnindent720pnhang{pntxta .}}{*pnseclvl2
pnucltrpnstart1pnindent720pnhang{pntxta .}}{*pnseclvl3
pndecpnstart1pnindent720pnhang{pntxta .}}{*pnseclvl4
pnlcltrpnstart1pnindent720pnhang{pntxta )}}{*pnseclvl5
pndecpnstart1pnindent720pnhang{pntxtb (}{pntxta )}}
{*pnseclvl6pnlcltrpnstart1pnindent720pnhang{pntxtb (}
{pntxta )}}{*pnseclvl7pnlcrmpnstart1pnindent720pnhang
{pntxtb (}{pntxta )}}{*pnseclvl8pnlcltrpnstart1
pnindent720pnhang{pntxtb (}{pntxta )}}{*pnseclvl9pnlcrm
pnstart1pnindent720pnhang{pntxtb (}{pntxta )}}pardplain
sl480slmult1widctlparadjustright fs20cgrid {fs24ulabc }
{ul par }}

The markup language that most people are familiar with these days is HTML, but it's easy to see how that language doesn't provide enough power for anything beyond creating standard Web pages.

HTML 1.0 consisted of only a dozen or so tags, but the most recent version, HTML 4.01, consists of almost 100—if you include the other tags added by the major browsers, that number is closer to 120. But as handling data on the Web and other nets intensifies, it's clear that 120 tags isn't enough—in fact, you can never have enough.

For example, what if your hobby was building model ships, and you wanted to exchange specifications with others on the topic? HTML doesn't include tags such as <BEAMWIDTH>, <MIZZENHEIGHT>, <DRAFT>, <SHIPCLASS>, and others that you might want. What if you worked for a major bank and wanted to exchange financial data with other institutions—would you prefer tags such as <B>, <UL>, and <FONT> or tags such as <FISCALYEAR>, <ACCOUNTNUMBER>, and <TRANSFERACCOUNT>? (In fact, such markup languages, including Extensible Business Reporting Language, exist now and are built on XML.)

Likewise, what if you were a Web browser manufacturer who wanted to create your own markup language to let people configure your browser, adding scrollbars, toolbars, and other elements? You might create your own markup language. In fact, Netscape has done just that with the XML-based User Interface Language, which we'll see in this chapter.

The upshot is that there are as many reasons to create markup languages as there are ways of handling data—and, of course, both are unlimited numbers. That's where XML comes in: It's a meta-markup specification that lets you create your own markup languages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.180.161