|
XML as a scripting language
|
 |
No abstract was provided for this paper.
XML as a scripting language
Most XML applications have been developed using one of the widely-used
web development languages such as Java, Perl, or Visual Basic. Since these
languages all predate XML, they had to be augmented with extensions for processing
XML. The most common extensions, XML parsers, are widely available.
An alternative is to use XML itself as the scripting language. I focus
here on XFA Script (
http://www.xmlforall.com), a language I developed,
but most of my remarks apply equally well to other XML-based scripting systems
such as XML Script (
http://www.xmlscript.org).
Unlike languages where XML support was an afterthought, XFA Script was
designed from the start around XML, making it ideally suited for processing
XML data. There are however even more important advantages of XML-based scripting.
- 1. Most XML processing languages are double-level where a program written
in a language such as Java produces output in a second language, XML. This
is accomplished with formatted I/O or string processing that obscures the
structure of the output. In XFA Script output is directly interleaved in the
processing program making it easier to write, check, and understand.
- 2. XFA scripts are themselves just XML. This means that XFA code can
be treated as data, making it easy to write scripts that manipulate other
scripts. XFA Script also can make any XML data into a program by specifying
the active behavior associated with each data element type.
- 3. The XML community continues to produce ever more specialized XML
processing standards. With DTD's and schemas for validating data, XSL and
XSLT for rendering and transforming data, and with pointers, links, paths
and RDF to connect data, the overall complexity continues to soar. XFA Script
is a single simple general-purpose language that can be used for all these
purposes.
- 4. Although DTD's and schemas allow XML syntax to be formally described,
very little has been done on the more important problem of formal specification
of XML semantics. Since XFA Script is itself XML and has a clean clear semantics,
it is an ideal notation for defining the semantics of XML data. An added bonus
is that XFA semantic specifications can easily become executable semantic
checkers.
XML scripting is not without some problems. The XML syntax does not
lend itself well to scripting. XFA Script handles this with extended XML syntax
that adds expression forms to XML attribute values. A one-to-one mapping is
defined between this form and a less readable strict XML form. Another problem
is what should be the exact set of tags used for XML scripting? Although I
believe the XFA Script tags are well chosen, I make no claims to their unique
utility. To accommodate diversity, XFA Script makes it easy to define interpretation
rules for other tag sets.
XFA Script has been used for over three years to produce a wide range
of XML applications. Experience has strongly confirmed all the advantages
of XML-based scripting discussed here.