Why MOE?

Java developers already have two very different APIs for working with XML generically: the W3C Document Object Model (DOM) and the Simple API for XML (SAX). The DOM's tree-based approach to documents provides complete accessibility to document content at the cost of a large memory footprint, while SAX's event-based approach saves memory but at the cost of presenting only a small portion of the document at any given time.

Markup Object Events (MOE) seeks a middle ground between these two approaches. Developers frequently want to combine the efficiency of SAX processing with some degree of DOM accessibility. While it is possible to combine the two interfaces, the API designs are quite different, forcing programmers to work with two very different styles. MOE offers a unified style that supports both event- and tree- approaches.

Like SAX, MOE supports an event-passing approach to reading XML documents. Like DOM, MOE describes XML documents as objects, rather than a series of strings and characters. The interfaces between classes generating and receiving MOE events can be much simpler because they only need to pass and receive objects implementing a single interface. Developers can work with these objects much like they work with SAX events, or they can combine the objects into trees representing portions of XML documents.

MOE also supports the transfer of information at different granularities. While SAX always sends attributes with the startElement() event and the DOM presents complete trees, MOE permits developers to follow that approach, send attributes separately, or start with an initial list of attributes and add more later. (A set of classes which 'normalize' events to fit a particular expected form will also be a part of MOE.)

MOE is also more loosely bound to XML than either SAX or the DOM. While the basic set of classes provided with MOE is designed with XML in mind, the overall design of MOE is designed to support any kind of named hierarchical structure. Each MOE object can contain:

This fundamental structure is easily extended to support a wide variety of content types. While it is optimized for XML, other data structures (CSV, relational tables, ASN.1) may also be stored in this form. A rough hierarchy is all that is needed to make these objects usable in an XML environment.

MOE is also notable in that it doesn't prevent the storage of information which can't be readily expressed in XML. Annotations information in particular may not have an easily 'XML-izable' representation, but it's possible, for example, to create unordered content (attributes) which has its own unordered content (attributes). Some information will be lost if these objects are written out as XML, but applications may use that information or modify the structure of the XML to accomodate the preservation of such information.

Events and objects

Filtering and visiting