XML as scripting language   Table of contents   Indexes   XML as a scripting language

 

Scriptable XML

Thibadeau, Robert
 
 Robert  Thibadeau
 Ph.D.
 Associate Director
 ECommerce Institute, School of Computer Science
 Pennsylvania 
 Pittsburgh 
 USA 
ECommerce Institute, School of Computer Science,  Carnegie Mellon University,  Pittsburgh  Pennsylvania USA email: rht@cs.cmu.edu
 Biography
 Robert Thibadeau - Robert Thibadeau is director of the Universal Library Project and has overseen a number of XML projects including the current project by the Academic Image Cooperative to provide all Art and Art History images for class room instruction in the United States. He is author of several programming languages, arbitor of the namespace for digital television globally, and one of the founding directors of the Robotics Institute in the School of Computer Science at Carnegie Mellon University.
 Abstract
 There is an ongoing controversy as to whether XML should be scriptable. XML allows the creation of scripting languages that import the full power of a programming language into a particular XML interpreter. With this power, documents can be created that are truly dynamic. However, there are good arguments against providing XML with this extended functionality.
 It may seem impossible, on the face of it, to guarantee insufficiency, particularly for anybody’s needs. We can, however, do it with the reasonable assumption that whatever XML DTD or finite set of DTDs that you choose, you will want, at some time, to relate the document in your DTDs to documents created by other, foreign, DTDs. In other words, there is not a single DTD out of which all DTDs agree (this can be proven trivially by creating a direct conflict between DTDs and staying within the XML specification). If the relationship between two markup systems involves a conditional test, then XML is insufficient without scripting, since XML does not provide such conditionals. An example would be converting a document type that describes states and provinces into a document type that describes countries as well as states and provinces. Another one would be converting a document from one metadata system to another metadata system. Another would, by the way, simply trying to provide a DTD for Postscript or PDF, since either embed a scripting language.
 Now we have a problem in what is called process or relational semantics. Two DTDs that are perfectly consistent internally may not have a DTD that can describe the relationship between them. You have only to ask: is the assumption right? Am I going to want to know how one document using one DTD relates to another document using another one? Is this a need I will always have? I would argue that it is obvious and fundamental that it is.
 In having said this, there is no insufficiency that is internal in a document. A conditional inclusion or exclusion of markup opportunity by particular markup selection simply requires different DTDs to be invoked on different components of a document.
 However, there is an interesting process semantics problem if one wishes to convey interactive views. Right now we must go outside of XML, to Javascript and the like, to determine if the credit card number is consistent. Putting constraints on interactivity explicitly in the document requires scripting. Yet there are natural interactive documents, like crossword puzzles and textbooks with question/answer sections. Where does one put the answer to the crossword puzzle, and how is that related to the interaction with the crossword puzzle? For a crossword puzzle to be a crossword puzzle, this must surely be relevant. It doesn’t take much to understand that even textbooks and technical manuals assume interactivity that cannot be represented in XML without scripting.
 XML as a formal language contains semantics for abstract data types. That is basically all. There are no process semantics except for some very coarse ones (like the ones associated with DTD selection). This invariably means that XML is insufficient for routine applications. Once you go outside of XML, you get to choose which of the morass of programming languages, in what machine contexts, grounds the interpretation of the dynamic document specification or the inter-document relationships. A much more natural approach would be to provide XML with scripting specification primitives such as scoped variable binding and conditional actions. Such scripting would greatly enhance the universality of XML. Ask yourself the questions: (a) is the DTD(s) I am using the only one(s) I will ever have to use for my content? And (b) are the documents I am using always going to be static and non-interactive? If both answers are “Yes,” then you have proven me wrong. If either answer is “No” then perhaps you should want well-defined scripting with your XML

XML as scripting language   Table of contents   Indexes   XML as a scripting language