Class AbstractStAXEventProcessor

java.lang.Object
org.jdom2.output.support.AbstractOutputProcessor
org.jdom2.output.support.AbstractStAXEventProcessor
All Implemented Interfaces:
StAXEventProcessor

public abstract class AbstractStAXEventProcessor extends AbstractOutputProcessor implements StAXEventProcessor
This class provides a concrete implementation of StAXEventProcessor for supporting the StAXEventOutputter.

Overview

This class is marked abstract even though all methods are fully implemented. The process*(...) methods are public because they match the StAXEventProcessor interface but the remaining methods are all protected.

People who want to create a custom StAXEventProcessor for StAXEventOutputter are able to extend this class and modify any functionality they want. Before sub-classing this you should first check to see if the Format class can get you the results you want.

Subclasses of this should have reentrant methods. This is easiest to accomplish simply by not allowing any instance fields. If your sub-class has an instance field/variable, then it's probably broken.

The Stacks

One significant feature of this implementation is that it creates and maintains both a NamespaceStack and FormatStack that are managed in the printElement(XMLEventConsumer, FormatStack, NamespaceStack, XMLEventFactory, Element) method. The stacks are pushed and popped in that method only. They significantly improve the performance and readability of the code.

The NamespaceStack is only sent through to the printElement(XMLEventConsumer, FormatStack, NamespaceStack, XMLEventFactory, Element) and printContent(XMLEventConsumer, FormatStack, NamespaceStack, XMLEventFactory, Walker) methods, but the FormatStack is pushed through to all print* Methods.

Since:
JDOM2
Author:
Rolf Lear
See Also: