David
Megginson has announced
NewsML Toolkit 1.1beta,
"an extensive rewrite of version 1.0" still "kindly sponsored"
by Reuters PLC and published under an open source (LGPL) license.
Beyond the
features specific to the NewsML application, this toolkit could probably be
used as an example of best practices for writing Java APIs for XML applications.
The toolkit is published with a good deal of documentation, including an "architectural
overview".
The package
has been decoupled from the parser API through a factory. Although this beta
release only includes a factory interfaced with the DOM, Megginson explains
how and why other factories might be developed:
-
A backend
built using the Simple API for XML (SAX) interface would be able to read a
NewsML package in a quick, single pass, with minimum memory
overhead.
-
A backend
built on top of a database could execute database queries directly to
build the different parts of a NewsML document.
-
A validating
backend could apply business rules to every part of the NewsML package as
it is queried.
-
A masquerading
backend could make data in another news-industry format appear as NewsML
to an application.
Another
area of generic interest is the conformance testing toolkit, which lets people
register their own conformance tests written in Java and performed on the nodes
of a node set returned by an XPath expression. This principle appears to be
similar to Schematron assertions except that the tests are written in Java
while Schematron assertions are written using XPath/XSLT. This framework comes
with general tests validating the NewsML rules and can be used to add other
specific tests:
Starting with version
1.1beta, the NewsML Toolkit includes support for testing a NewsML document's
conformance to the functional specification. Low-level DTD-based structural
validation is available through the underlying XML parser; higher-level, conformance
testing is now handled by the org.newsml.toolkit.conformance package. The
conformance framework is fully open and configurable, so users can easily add
conformance tests for local business logic.
Other
story: