com.aliasi.xml
Class DelegateHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.aliasi.xml.SimpleElementHandler
com.aliasi.xml.DelegateHandler
- All Implemented Interfaces:
- ContentHandler, DTDHandler, EntityResolver, ErrorHandler
public class DelegateHandler
- extends SimpleElementHandler
A DelegateHandler may be used with a delegating
handler to more efficiently implement nested embeddings. A
delegate handler contains a pointer back to its delegating handler
in order to coordinate further delegation from the delegate
handler.
- Since:
- LingPipe2.0
- Version:
- 3.8
- Author:
- Bob Carpenter
|
Constructor Summary |
DelegateHandler(DelegatingHandler handler)
Construct a delegate handler that coordinates recursive
delegation with the specified delegating handler. |
| Methods inherited from class com.aliasi.xml.SimpleElementHandler |
addSimpleAttribute, characters, characters, characters, characters, createAttributes, createAttributes, createAttributes, createAttributes, createAttributes, createAttributes, endSimpleElement, endSimpleElement, startEndSimpleElement, startEndSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DelegateHandler
public DelegateHandler(DelegatingHandler handler)
- Construct a delegate handler that coordinates recursive
delegation with the specified delegating handler.
setDelegate
public void setDelegate(String qName,
DefaultHandler handler)
- Calling this method causes subsequent events embedded within
the specified element to be delegated to the specified handler.
If the events will might be further delegated, this handler
should itself be a delegate handler. If the specified handler
is a delegate handler, it must be tied to the same delegating
handler as this delegate handler.
- Parameters:
qName - Qualified name of element.handler - Handler to accept delegated events.
- Throws:
IllegalArgumentException - If the handler is a delegate
handler that is tied to a different delegating handler.
finishDelegate
public void finishDelegate(String qName,
DefaultHandler handler)
- This method is called when this handler has finished delegating
the specified element to the specified handler. This
implementation is a simple no-operation adapter; subclasses
should override it if they need to take action on delegate
completion. This is most typically used for arranging data
collected by delegates results into larger data structures.
- Parameters:
qName - Qualified name of element.handler - Name of handler that handled the delegated
events.
startElement
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
- Starts the specified element with the specified attributes.
This method is used to coordinate delegation, and any subclasses
implementing it should first make a call to this implementation
through the
super construct.
- Specified by:
startElement in interface ContentHandler- Overrides:
startElement in class DefaultHandler
- Parameters:
namespaceURI - The URI identifying the name space, or
null if there isn't one.localName - Local name of element.qName - Qualified name of element, which is prefixed with
the name space URI and a colon if it is non-null, and is equal
to local name if there is no name space specified.atts - Attributes for this element.
- Throws:
SAXException - if the contained hanlder throws a SAX
exception.