net.sf.stax
Class DispatchOnElement.ByNsURI
java.lang.Object
net.sf.stax.StAXContentHandlerBase
net.sf.stax.DispatchOnElement
net.sf.stax.DispatchOnElement.ByNsURI
- All Implemented Interfaces:
- StAXContentHandler
- Enclosing class:
- DispatchOnElement
public static final class DispatchOnElement.ByNsURI
- extends DispatchOnElement
On-element dispatch that chooses handlers by namespace URI.
This class replaces
class FooHandler
extends StAXContentHandlerBase
{
public void startElement(..., StAXDelegationContext dctx)
{
if ("urn:net.sf.stax:bar".equals(nsURI))
{
dctx.delegate(barHandler);
}
else if ("urn:net.sf.stax:baz".equals(nsURI))
{
dctx.delegate.(bazHandler);
}
}
}
with
DispatchOnElement dispatch = new DispatchOnElement.ByNsURI();
dispatch.setHandler("urn:net.sf.stax:bar", barHandler);
dispatch.setHandler("urn:net.sf.stax:baz", bazHandler);
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DispatchOnElement.ByNsURI
public DispatchOnElement.ByNsURI()
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).