Illustrated is a simple and extensible design for implementing XML transformations. An example of XML schema extension is presented. Specifically, extending the QJML schema language with inheritance semantics. The language extensions are transformed via the XML-Transformer into QJML which the JXML binding engine then interprets directly. A thought example is also provided. In this example, transformations are rule-governed and have the feel of logic programming languages. In this illustration, XML transformation used to complete a higher-level ALP PlugIn contract language.
Application of an XML transformer/preprocessor enables rapid prototyping and experimentation with XML language design. The model of this particular transformer, though simple, is powerful in that it enables transforms to be easily customized and "plugged in" via use of "logic providers".
Transform Logic Providers is java code which implements a specialized transform behavior for converting one XML documement into another. The Transformer applies all logic providers to a document, effecting any transformations upon the target document they so implement. A Logic Provider is a java class which implements the following interface:
//
// A Logic Provider (LP) is a piece of java code which can be "plugged into" the
// the Transfomer to implement a specific XML transformation. An LP
// implements the LogicProvider interface (below).
//
// BElements are java instances of XML elements which are constructed via
// the SAX parser.
//
// test_in_domain() must accept any XML element (represented as BElement instance)
// which apply() or finalize() can act upon. IE. test_in_domain() must accept
// the superset language of apply() and finalize()
//
// ** LogicProviders must locate transformation implementation in apply()
// ** Contain any clean-up/consume language extension properties in finalize()
//
public interface LogicProvider {
//
// Identifies if BElement is in "domain" of this logic provider.
// BElement is in domain of LP IFF it uses language extensions which
// are specialized to that LP --
//
public boolean test_in_domain(BElement be);
//
// apply() only applied if test_in_domain() == true
//
public void apply(BElement be, Vector allElementsContext);
//
// finalize() is called for each document after all transformations
// are applied. It is called for every BElement which
// tested is in domain of this LP (ie. test_in_domain() == true)...
//
public void finalize(BElement be);
}
Currently, the Transformer implements no strategy for managing confliciting sets of Transform Logic Providers. In its naive simplicity it now assumes that all Logic Providers (LPs) are disjoint in scope and that there is otherwise no dependencies among them.
Where a Transfomer must manage multiple competing Transformation strategies, this is too simplistic a view. The Transformer would need to resolve conflicting transformation strategies.
Transformer Comments:Contact Nathan Combs. Last modified 10 June 2000 © BBNT Solutions LLC