2
$\begingroup$

I see nowadays XML is used to structure any file or data. It can represent both flat and hierarchical relationships. For example, it can be used to show the parse tree of a sentence in a natural language.

I am not familiar with different types of data and knowledge structures, but I would like to know if XML is theoretically the ultimate representation scheme which can model and structure any data and knowledge?

What are the reasons behind the popularity of XML?

$\endgroup$
6
$\begingroup$

XML is nothing more than a well-defined way to store trees of strings. Since even plain strings can encode everything you can encode in practice (i.e. countable sets), yes, XML can "model" everything.

But that's nothing special.

The popularity of XML is probably due to

  1. it being standardized and
  2. the amount of tool support that has developed.

There is no information-theoretic miracle involved.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ In addition, XML distinguishes itself from other formats like JSON by providing better support for hierarchical data and namespaces. $\endgroup$ – Robert Harvey Jun 13 '15 at 4:17
  • 1
    $\begingroup$ @RobertHarvey JSON is hierarchical, too. Namespaces are an XML thing, true. That (and stuff like XSLT) is an effect of the possibility to define valid subsets of XML to be "your" language. Maybe I should add that as item 3? $\endgroup$ – Raphael Jun 13 '15 at 8:12
  • $\begingroup$ You might add: the amount of standardized tool support, specifically for selection (XPath), grammar definition and checking (XML Schema, some alternatives) and transformation (XSLT). Noone likes these but they're standard. $\endgroup$ – reinierpost Dec 9 '16 at 11:06
-4
$\begingroup$

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 the form <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&amp;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 < and > to 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 <allergies>, <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.

References

| cite | improve this answer | |
$\endgroup$
  • 5
    $\begingroup$ Welcome to the site. Since you have quite a bit of reputation on Stack Overflow, you should be well aware that we're looking for answers to the question at the top of the page. If there is an answer hidden in all that quoted text, I didn't notice it. If I missed the actual answer, could you trim all the irrelevant ranty stuff to leave just that, please? $\endgroup$ – David Richerby Dec 9 '16 at 9:38
  • 2
    $\begingroup$ Also, copy-pasting huge chunks of stuff does not make good answers. $\endgroup$ – Raphael Dec 9 '16 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.