Is XML the ultimate representation scheme? No:
When the markup overhead exceeds 200%, when attributes values and element contents compete for the information, when the distance between 99% of the "tags" is /zero/, when the character set is Unicode, and when validation takes more time than processing, not to mention the sorry fact that information longevity is more /threatened/ by XML than by any other data representation in the history of computing, then SGML has gone from good kid, via bad teenager, to malfunctioning, evil adult as XML.
As for writing SGML/XML/HTML/whatever, I have a simple way to get rid of
the annoying verbosity of these stupid languages while retaining that
mistake between attribute values and elements, because it is quite hard
to make simple regular expression-based conversions retain enough data
about an element to decide what should be attribute and element. An
element has the form
<name [attributes] | [contents]>. Attributes have
<name | value>. Internal whitespace is only for readability.
XML Enamel (NML) CL
<foo/> <foo> (foo)
<foo bar="zot"/> <foo <bar|zot>> (foo (bar "zot"))
<foo>zot</foo> <foo|zot> (foo "zot")
<foo bar="zot">quux</foo> <foo <bar|zot> |quux> (foo (bar "zot")"quux")
<foo>Hey, &quux;!</foo> <foo|Hey, [quux]!> (foo "Hey, " quux "!")
<foo>AT&T you will</foo> <foo|AT&T you will> (foo "AT&T you will")
<foo><bar>zot</bar></foo> <foo|<bar|zot>> (foo (bar "zot"))
So I have almost none of the annoying and arbitrary quote/escape mania in
attribute values or contents alike, either. Entities I write as [name],
and they end up in the Lisp version as symbols if not the character they
represent purely for syntactic reasons. Writing "code" in this language
is actually amazingly painless compared to the produced noise. Besides,
with a few simple modify-syntax-entry calls in Emacs, I get
match and blink and I can move up and down the structure very easily.
What are the reasons behind its popularity? Well:
Inspired by the success of GML, the American National Standards Institute (ANSI) Committee on Information Processing assembled a team, with Goldfarb as project leader, to develop a standard text-description language based upon GML. The GCA GenCode committee contributed their expertise as well. Throughout the late 1970s and early 1980s, the team published working drafts and eventually created a candidate for an industry standard (GCA 101-1983) called the Standard Generalized Markup Language (SGML). This was quickly adopted by both the U.S. Department of Defense and the U.S. Internal Revenue Service.
A number of industries, including the aerospace, automotive, telecommunications, and computer software industries, have been using hub languages to perform data interchange for years, and by this time the process is well understood. Typically, the major players in an industry form a standards consortium tasked with defining a Document Type Definition, which is the way in which the tag set and grammar of a markup language are defined. This DTD can then be sent with documents that have been marked up in the industry standard language using off-the-shelf editing tools, and any standard application on the receiving end can validate and process them.
The XML solution is system-independent, vendor-independent, and proven by over a decade of SGML implementation experience. XML merely extends this proven approach to document interchange over the Web. Interestingly, the same day on which the first XML 1.0 draft was released also saw the formal announcement of an SGML initiative within HL7, the standards organization for health care IS vendors, to develop a Health Care Markup Language designed to solve exactly the kind of problem described in this example.
Previous vertical-industry efforts have shown that capturing data in a rich markup often has benefits beyond the immediate requirements of data exchange. In a well-designed standardized patient data system, for example, specific information originally gathered in the course of a routine physical exam and tagged
<drug-reactions>, and so on would instantly be available to alert the staff of an emergency room that an unconscious patient from a distant city was allergic to penicillin. The ability of XML to define tags specific to an area of application is critical to this scenario, because the otherwise unqualified word "penicillin" in the thousands of pages of a patient's entire medical history could not trigger the recognition that the same word inside an
<allergies> element could trigger.