XML as a programming tool
Peter Murray-Rust
peter at ursus.demon.co.uk
Fri Dec 19 10:08:58 GMT 1997
This message is probably trivial for those with a lsp+ gene, but it may
open new horizons for those like me.
It has come as a revelation to me that XML *with its assorted toolkit* is a
powerful programming aid for many applications. Most (non-textual)
applications of XML will come with a Tree tool including editing, display,
searching (a la TEI Xpointer), and transformation. These facilities are
extremely useful in program development and maintenance. Since JUMBO
implements all of these I have started to use these *in creating JUMBO
itself*, and potentially as library routines for other non-Jumboid
applications.
For example, I have been revising the menu structure in JUMBO under
java.awt. It's easy to make the mistake of hardcoding this, so it needs a
flexible data structure. Moreover the menus may easily be changed at
runtime (e.g. a new DTD or namespace may be loaded). Java menus (presumably
like many other systems) are tree-structured with a number of different
terminals (e.g. addSeparator();).
I have therefore created the data structure as an XML document, which is
built into a tree at startup. This is very easily extensible, both in
structure (e.g. adding new MenuItems or Menus) or adding properties to
individual parts (e.g.
<MENUITEM TITLE="Print" ENABLED="F"/>
** Because of the Xpointer I don't have to remember the structure of the
tree!! **. I can just search for a
DESCENDANT(ALL,MENUITEM,TITLE,Print)ANCESTOR(1,FILE), for example to get
all instances of the "Print" command in the menu (and, say,
SGMLNodeSet.addSGMLAttribute("ENABLED", "T")
An amusing byproduct is that the menu itself is available as a tree, and so
can be navigated or edited. It's trivial to attach HELP to the nodes of
this tree. So it's a really efficient re-use of tools.
As I may have mentioned before, I am converting all *external* files to XML
so that a JUMBO application can rely on namespace schemas,
mimetypes/helpers, Classloaders, DTDs, Help, semantic validation, etc. all
being manageable through XML technology. The benefits of this (at least
for me) are enormous! Obviously all of this is in Java for JUMBO, but I
assume that people will convert or develop tools for other languages such
as C and UNIX. I hope that we may see
man xmltree
or
man teisearch
on UNIX systems in the near future and that people will be able to use the
treetools that these provide. Obvious extensions to other environments.
I am sure that the original proposers of XML saw and knew all of this, but
it must be very clear that XML has much more to offer than 2D paper
technology :-)
P.
Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list