SGML: Java and XML
Subject: Java and XML
Date: Mon, 13 Jan 97 12:22:13 GMT
From: Peter@ursus.demon.co.uk (Peter Murray-Rust)
Newsgroup: comp.text.sgml
----------------------------------
As part of the Version 1.0 release of Chemical Markup Language (an SGML
application) at http://www.venus.co.uk/omf/cml/ I have written an XML-like
parser and GUI. There are many examples of the graphical output, including
one of CMLviewer displaying Jon Bosak's Julius Caesar in XML :-) One
package (pmr.sgml) may be of particular interest since it provides the
parser (creating an SGMLTree object in memory) and allows for dynamic
loading of different DTD classes. It uses the (graphical) TOC model in an
SGMLTOC class which lets the user navigate a the parse tree.
The primary purpose of pmr.sgml is to allow non-textual SGML
applications to be rendered, processed transformed and edited.
This is done in Java by subclassing Elements in the parse tree.
Thus when <MOL> is recognised in an SGMLStream a MOLNode is created, and
this allows molecular rotation, calculation of spectra, etc. through
discipline-dependent classes. The mechanism is general, and can be used
for graphs and other applications. (See
http://www.venus.co.uk/omf/cml/doc/api/sgml.html for the generic SGML
classes.)
Part of the strategy is that a DTD object is created when the
document is read and the appropriate set of classes for ElementTypes are
downloaded. Thus a DOCTYPE of CML will dynamically load CMLDTD.class,
which enumerates the potential ElementTypes in the document (e.g. MOLNode,
ATOMSNode, etc.) For PLAY it would load PLAYDTD which would load PERSONA,
SPEECH, etc. and these can then be crafted in Java. I'm aware that for
text this is probably better done through stylesheets, and I would be very
interested to hear from anyone combining a style sheet approach with Java
classes - is it technically possible?
I am very keen that developments in this area are re-usable and
interoperate and will make my *.class available freely. I have
corresponded with Jon Bosak and Tim Bray who have been very helpful and
Tim has assured me that the Lark parser will be freely and always
available in binary form as a non-validating parser. I was able to bolt
Lark into my application in an hour which demonstrates that tools are
really re-usable at this level. I shall junk my parser and move to Lark,
after I have altered some of my namespace.
CMLviewer is available to anyone who would like to collaborate,
but it is not designed for high-quality textual applications. (If anyone
has a good Java hypertext renderer for free I'd love to know). I would be
particularly keen on sharing experience and (Java) tools in the areas of
- tables (including non-numeric cells)
- graphs
- maths and equations
- linking to terminologies and glossaries
- mixing DSSSL and Java
- DSSSL-like or CoST-like searches of the parse tree (presently
mine are fairly crude)
- rendering of trees and similar objects
- and, of course, molecular sciences :-)
Peter
(Please send any replies to peter.murray-rust@nottingham.ac.uk)
Peter Murray-Rust (PeterMR, ) Director, Virtual School of Molecular Sciences
Pharmaceutical Sciences, Nottingham University, NG7 2RD, UK; Tel 44-115-9515100
Fax 5110 http://www.nottingham.ac.uk/vsms/; OMF: http://www.ch.ic.ac.uk/omf/