net.sf.stax
Class DispatchOnElement.ByQName
java.lang.Object
net.sf.stax.StAXContentHandlerBase
net.sf.stax.DispatchOnElement
net.sf.stax.DispatchOnElement.ByQName
- All Implemented Interfaces:
- StAXContentHandler
- Enclosing class:
- DispatchOnElement
public static final class DispatchOnElement.ByQName
- extends DispatchOnElement
On-element dispatch that chooses handlers by qualified XML name.
This class replaces
class FooHandler
extends StAXContentHandlerBase
{
public void startElement(..., StAXDelegationContext dctx)
{
if ("bar".equals(qName))
{
dctx.delegate(barHandler);
}
else if ("baz".equals(qName))
{
dctx.delegate.(bazHandler);
}
}
}
with
DispatchOnElement dispatch = new DispatchOnElement.ByQName();
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.ByQName
public DispatchOnElement.ByQName()
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).