JAST: Java Abstract Syntax Trees

Natural Java idioms for processing XML data

You are here: JAST Home /
Department of Computer Science

The JAST Home Page

JAST is an acronym for Java Abstract Syntax Trees, a project to build a better API for processing XML in Java.

JAST allows you to read and write XML data using natural Java programming idioms. The standard XMLReader creates a document object model in memory, consisting of nodes that obviously mimic the XML content directly: Document, Declaration, Instruction, Doctype, Element, Attribute, Text, Comment and so on. By contrast, the custom ASTReader unmarshals a strongly-typed tree consisting of your own Java AST node classes, supporting strongly-typed programming directly from XML data. Finally, the streaming XMLParser allows serial scanning of very large XML files, using your own Builder to construct Java objects selectively from recognised events.

JAST was partly inspired by earlier XML processing APIs for Java, but improves on the weighty and memory-hungry DOM and is more compact than JDOM, which depends on several external packages. Java programmers will recognise the benefits of strongly-typed lists and trees, consistent design of XML node types, a library of useful filters, built-in tree traversal using foreach and the ability to unmarshal XML directly into their own Java classes, and marshal Java back again to XML.

JAST unifies a number of different XML processing utilities in one place, for which you would normally expect to need several different, possibly incompatible, Java packages. It includes fast DOM-tree reading and writing (like JAXP, JDOM or Xerces), elegant object marshalling and unmarshalling (simpler to set up than JAXB), streaming event-based building (like SAX), an XPath search engine (like Jaxen or Java XPath) and document validation using Document Type Definitions (DTD), or XML Schema Definitions (XSD) (like JAXP or Java Validation). The economies of scale gained by integrating these facilities means that each sub-package shares a lot of common code. We think that JAST is the most compact XML processing package for Java that provides all of these facilities.

Java Abstract Syntax Trees icon
Regent Court, 211 Portobello, Sheffield S1 4DP, United Kingdom