![]() |
|
| F E A T U R E | |
A Metalanguage For the Ages April 3, 2000 By Ahmad Abualsamid XML (Extensible Markup Language) is the key to creating markups that can be used by any number of applications beyond the Web browser. XML is not really a language, but a metalanguage: It defines and describes the language, much like a grammar (with terms such as subject, verb and object) describes the English language. This metalanguage is an offshoot of GML (Generalized Markup Language) and its standardized descendant, SGML, which was invented in the 1960s and let users--particularly large government agencies, including the IRS and Department of Defense--define their own markups. Because it's a metalanguage, XML is not meant to replace HTML. A specific implementation of SGML, HTML focuses on the presentation, rather than the description, of data. HTML was invented in 1989 by Tim Berners-Lee of CERN as a way to exchange physics documents and preserve their content regardless of the presentation medium. CERN programmers developed a simple GUI editor to create HTML documents and a browser to view them, and the World Wide Web was born. Unlike XML, HTML cannot be used to define other languages. Rather, XML enables users to define their own languages, with tags that have specific meaning within the context of their documents. XML gives no information about presentation. Rather, it is a mechanism to convey content that may appear one way when printed and a completely different way on a desktop computer's browser. For example, XML may be used to create markup for a database that can allow smooth exchanges and updates of patient information among scheduling, billing and medical-records applications. It doesn't matter which program uses the data: What's important is the content--the patient's name, social security number and so on. The markup might include tags like <patient> and <illness> rather than <bold> or <italic>.
Pieces of the Puzzle XML documents must be both well-formed and valid. A well-formed document obeys all the general XML rules; a valid one adheres perfectly to a specific DTD--and it must be well-formed to do so. Here's an example of a simple but well-formed XML document: <?xml version="1.0"?> <oldjoke> <burns>Say<quote>goodnight,</quote> Gracie.</burns> <allen><quote>Goodnight, Gracie. </quote></allen> <applause/> </oldjoke> The tags in the document are similar to those used in SGML or HTML. With a little effort, a reader can figure out the gist of the document without using any software tools. The example above is well-formed because it follows the general structural rules of XML. However, the above document alone is meaningless. To add meaning, it needs a DTD such as the one here: <!ELEMENT oldjoke (burns+, allen, applause?)> <!ELEMENT burns (#PCDATA | quote)*> <!ELEMENT allen (#PCDATA | quote)*> <!ELEMENT quote (#PCDATA)*> <!ELEMENT applause EMPTY> This DTD provides XML definitions for five elements. The first element, oldjoke, must have one or more burns elements, one and only one allen element, and may (but is not required to) contain exactly one applause element. #PCDATA is a keyword that indicates any sequence of characters. Thus, the element burns can contain any number of quote elements or character data. The * annotation means that the value may appear zero or more times. The ? means the value is optional: Either it appears exactly once or does not appear at all. The + sign indicates that the item must appear at least once. An EMPTY annotation means that the element does not require an end element tag and does not require any content. The above snippet of an XML document is clearly valid against its DTD. Now it might be formatted for use in an online collection of George Burns' one-liners, in a database of old jokes or as a document to be published as a compendium of comedy duos' skits without much tinkering.
| |
|
PAGE: 1 I 2 I 3 I 4 I 5 I NEXT PAGE |
|


Although XML is quite young, many successful implementations of it are available. In corporate America, the most significant use of XML is for data transfer among e-businesses to replace EDI systems. The real-estate industry has an XML-based markup language to make it easier to use its Multiple Listing Service. Other examples of XML implementations include MathML (Mathematical Markup Language), Xlink (XML Linking Language), SMIL (Synchronized Multimedia Integration Language) and, perhaps most important, XSL (Extensible Stylesheet Language).









