Java to XML and Back Again
For those who need a solution for Java and XML conversion, Jato can be applied across a wide variety of documents and code
by Peter Varhol
September 2002 Issue
One of the really enjoyable things about participating in the Java community is that many talented individuals come up with clever ways to do new things and then make those ways available to the community as a whole, often providing source code gratis. Just scanning the array of efforts in Apache and the Jakarta project demonstrates what a rich set of tools are available to ease specific software development tasks.
Such is the case with Jato, an open source library developed and promoted by Andy Krumel. Jato converts documents between XML and Java and can convert in either direction. Jato provides both the library and classes that perform the conversion, plus an interpreter that executes Jato scripts. I discovered Jato on SourceForge, the development community that claims it is the largest repository of open source code and applications available on the Internet.
Jato is a little like SAX (the Simple API for XML; check out my column "Extract XML Data Using SAX," in the August 2001 issue), except that SAX seems to be a bit more general-purpose, at least for its chosen task. SAX simply extracts data from XML documents. That data may be Java, but it could just as easily be anything else. If you're seeking to use XML in ways not supported by integrated development environments, you may have to parse and process the data with your own code. SAX is event-based, enabling an application to look for and extract specific pieces of information from a document without processing the entire document.
Back to top