This package contains classes that supply content handlers to a SAX parser that will read GEF diagrams in XML format (PGML files) and create the correspondig GEF diagram objects.

The classes in this model implement two distinct approaches to organizing the content handlers: a state machine and a stack-based approach.

State Machine Parser

The PGMLParser class parses PGML files with a single ContentHandler that is based on a state machine; the current state determines how each SAX event will be handled.

Stack-Based Content Handler

The remaining classes and interfaces in the package implement a parser for PGML files that is based on a stack of ContentHandler objects. Everytime the SAX parser encounters the start of an element, a new ContentHandler object is pushed on the stack and the SAX parser sends further events to that ContentHandler. When the parser detects the end of an element, the current ContentHandler is popped off the stack and the SAX parser sends further events to the underlying handler. The number of ContentHandler objects on the stack always reflects the nesting depth of elements at the SAX parser's current position in the document. This represents a more rigidly structured way of representing the parser state than the state machine used by PGMLParser, and is supposed to provide a more robust foundation on which to implement specialized diagram-reading behaviour in clients of the package.

{@link PGMLStackParser PGMLStackParser} is designed to be a drop-in replacement for {@link PGMLParser PGMLParser} for clients that wish to move to the new parsing model. Its implementation of the {@link HandlerFactory HandlerFactory} interface contains the logic for producing the appropriate content handler for each element that might appear in the PGML file. Clients can customize parsing behavior by sub-classing PGMLStackParser; in addition, any client-provided implementation of ContentHandler can assume full control over how sub-elements of that element are parsed.