Kinesis SoftwareKineticFusion

[Show Table of Contents]

10 RVML Reference

[Hide Table of Contents]



10.6.2 How Does RVML Processing Work?

All processing of the XML event is delegated to a KineticFusion ElementHandler, an object that implements the KFSaxElementHandlerType interface. An instance of this interface is responsible for processing a single document element, and for providing ElementHandlers to process child elements of the current element.

The KineticFusion ContentHandler maintains a stack of currently open elements. When a new StartElement event is received, the ContentHandler attempts to acquire an ElementHandler for the new element from the current ElementHandler by calling startSubElement(). If the specified element is a legal child of the current handler, the current handler will return an ElementHandler for the child element. The content handler will then store the current handler, replace the current handler with the new handler, and call handleElement() on the new handler. This handler, in turn, is responsible for providing ElementHandlers for its child elements.

Character events are always sent to the current ElementHandler. All ElementHandler implementations should accept character data, even if the characters are discarded, since many XML documents contains whitespace characters between elements.

EndElement events are sent to the current ElementHandler and processed by the endElement() method. In general, it is the responsibility of the handler to make sure that the state of the handler is reset once processing of an element is finished though we shall see that parent handlers also have opportunities to perform cleanup processing. If the current ElementHandler completes successfully, the parent handler is restored and is sent the endSubHandler() event. This allows handlers to explicitly process information gathered by the child handler but which the child handler does not possess sufficient context for processing the information.

The KineticFusion ContentHandler is initalized with a default root ElementHandler that knows about the Movie element, the root element in an RVML document.

All elements in the RVML namespace are processed by native KineticFusion handlers. Further on we shall see how handlers for new namespaces can be added to KineticFusion.