DispatchHandler implements the ElementHandler
interface and provides a means to register multiple
ElementHandler instances to be used by an event based
processor. This is a special ElementHandler in that it's
onStart and onEnd implementation methods are called for every
element encountered during the parse. It then delegates to other
ElementHandler instances registered with it to process the
elements encountered.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | atRoot
Whether the parser is at the root element or not |
| private ElementHandler | defaultHandler
|
| private HashMap | handlers
|
| private ArrayList | handlerStack
maintains a stack of previously encountered handlers |
| private String | path
The current path in the XML tree (i.e. /a/b/c) |
| private ArrayList | pathStack
maintains a stack of previously encountered paths |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addHandler(String
is the path to be handled handlerPath, ElementHandler is the handler)ElementHandler to be called by the event
based processor.Adds the |
| public boolean | Returns: true when anElementHandler is registered for the
specified path.DOCUMENT ME! handlerPath)DOCUMENT ME! |
| public int | Returns: number of active handlersReturns the number of |
| public ElementHandler | Returns: the registered handlerXML path to get the handler for handlerPath)Get the registered |
| public String | |
| public void | onEnd(ElementPath
is the current elementPath)ElementPath to processImplements org. |
| public void | onStart(ElementPath
is the current elementPath)ElementPath to processImplements org. |
| public ElementHandler | Returns: DOCUMENT ME!is the path to remove the handlerPath)ElementHandler for.Removes the |
| public void | resetHandlers()
Used to remove all the Element Handlers and return things back to the way they were when object was created. |
| public void | setDefaultHandler(ElementHandler
is the handler)ElementHandler to be called by the event
based processor.When multiple |
| atRoot | back to summary |
|---|---|
| private boolean atRoot Whether the parser is at the root element or not | |
| defaultHandler | back to summary |
|---|---|
| private ElementHandler defaultHandler
| |
| handlers | back to summary |
|---|---|
| private HashMap<String, ElementHandler> handlers
| |
| handlerStack | back to summary |
|---|---|
| private ArrayList<ElementHandler> handlerStack maintains a stack of previously encountered handlers | |
| path | back to summary |
|---|---|
| private String path The current path in the XML tree (i.e. /a/b/c) | |
| pathStack | back to summary |
|---|---|
| private ArrayList<String> pathStack maintains a stack of previously encountered paths | |
| DispatchHandler | back to summary |
|---|---|
| public DispatchHandler() | |
| addHandler | back to summary |
|---|---|
| public void addHandler(String handlerPath, ElementHandler handler) Adds the
| |
| containsHandler | back to summary |
|---|---|
| public boolean containsHandler(String handlerPath) DOCUMENT ME!
| |
| getActiveHandlerCount | back to summary |
|---|---|
| public int getActiveHandlerCount() Returns the number of
| |
| getHandler | back to summary |
|---|---|
| public ElementHandler getHandler(String handlerPath) Get the registered
| |
| getPath | back to summary |
|---|---|
| public String getPath() DOCUMENT ME!
| |
| onEnd | back to summary |
|---|---|
| public void onEnd(ElementPath elementPath) Implements org. Doc from org. Called by an event based processor when an elements closing tag is encountered.
| |
| onStart | back to summary |
|---|---|
| public void onStart(ElementPath elementPath) Implements org. Doc from org. Called by an event based processor when an elements openning tag is encountered.
| |
| removeHandler | back to summary |
|---|---|
| public ElementHandler removeHandler(String handlerPath) Removes the
| |
| resetHandlers | back to summary |
|---|---|
| public void resetHandlers() Used to remove all the Element Handlers and return things back to the way they were when object was created. | |
| setDefaultHandler | back to summary |
|---|---|
| public void setDefaultHandler(ElementHandler handler) When multiple
| |