net.sf.stax
Class DispatchOnElement.ByLocalName
java.lang.Object
net.sf.stax.StAXContentHandlerBase
net.sf.stax.DispatchOnElement
net.sf.stax.DispatchOnElement.ByLocalName
- All Implemented Interfaces:
- StAXContentHandler
- Enclosing class:
- DispatchOnElement
public static final class DispatchOnElement.ByLocalName
- extends DispatchOnElement
On-element dispatch that chooses handlers by local name.
This class replaces
class FooHandler
extends StAXContentHandlerBase
{
public void startElement(..., StAXDelegationContext dctx)
{
if ("bar".equals(localName))
{
dctx.delegate(barHandler);
}
else if ("baz".equals(localName))
{
dctx.delegate.(bazHandler);
}
}
}
with
DispatchOnElement dispatch = new DispatchOnElement.ByLocalName();
dispatch.setHandler("bar", barHandler);
dispatch.setHandler("baz", bazHandler);
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DispatchOnElement.ByLocalName
public DispatchOnElement.ByLocalName()
chooseHandler
protected StAXContentHandler chooseHandler(String nsURI,
String localName,
String qName)
throws SAXException
- Description copied from class:
DispatchOnElement
- Choose a handler for the specified namespace URI, local
name, and qualified XML name.
- Specified by:
chooseHandler
in class DispatchOnElement
- Parameters:
nsURI
- namespace URIlocalName
- local name (without prefix)qName
- qualified XML name (with prefix)
- Returns:
- a handler for the specified namespare URI, local
name, and qualified XML name
- Throws:
SAXException
- any SAX exception, possibly wrapping another exception- See Also:
DispatchOnElement
Copyright (c) 2001-2006 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).