|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.stax.StAXContentHandlerBase
net.sf.stax.DispatchForChild
public final class DispatchForChild
For-child dispatch. Use this class to handle multiple child
elements of the same type. The list of values, returned by the
endTree(StAXContext) method, is available to a
parent handler via its endElement(String, String, String,
String, Object, StAXContext) method.
For example, for the following (sub-)tree:
>foo< >int<0>/int< >int<1>/int< >int<2>/int< >int<3>/int< >int<4>/int< >/foo<
Use
class FooHandler
extends StAXContentHandlerBase
{
private List integerValues;
private DispatchForChild dispatch = new DispatchForChild(new IntElementHandler());
public void startElement(..., StAXDelegationContext dctx)
{
dctx.delegate(dispatch);
}
public void endElement(..., Object result, ...)
{
this.integerValues = (List) result;
}
}
| Field Summary |
|---|
| Fields inherited from interface net.sf.stax.StAXContentHandler |
|---|
IGNORE |
| Constructor Summary | |
|---|---|
DispatchForChild(StAXContentHandler handler)
Create a new for-child dispatch wrapping the specified handler. |
|
| Method Summary | |
|---|---|
void |
endElement(String nsURI,
String localName,
String qName,
Object result,
StAXContext ctx)
Receive notification of the end of an element. |
Object |
endTree(StAXContext ctx)
Receive notification of the end of a sub-tree of a document. |
void |
startElement(String nsURI,
String localName,
String qName,
Attributes attrs,
StAXDelegationContext dctx)
Receive notification of the beginning of an element. |
void |
startTree(StAXContext ctx)
Receive notification of the beginning of a sub-tree of a document. |
| Methods inherited from class net.sf.stax.StAXContentHandlerBase |
|---|
characters, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DispatchForChild(StAXContentHandler handler)
handler - wrapped handler| Method Detail |
|---|
public void startTree(StAXContext ctx)
StAXContentHandler
startTree in interface StAXContentHandlerstartTree in class StAXContentHandlerBasectx - StAX contextStAXContentHandlerBase
public void startElement(String nsURI,
String localName,
String qName,
Attributes attrs,
StAXDelegationContext dctx)
throws SAXException
StAXContentHandler
startElement in interface StAXContentHandlerstartElement in class StAXContentHandlerBasensURI - namespace URIlocalName - local name (without prefix)qName - qualified XML name (with prefix)attrs - attributes attached to the elementdctx - StAX delegation context
SAXException - any SAX exception, possibly wrapping another exceptionStAXContentHandlerBase
public void endElement(String nsURI,
String localName,
String qName,
Object result,
StAXContext ctx)
StAXContentHandler
endElement in interface StAXContentHandlerendElement in class StAXContentHandlerBasensURI - namespace URIlocalName - local name (without prefix)qName - qualified XML name (with prefix)result - resultctx - StAX contextStAXContentHandlerBasepublic Object endTree(StAXContext ctx)
StAXContentHandler
endTree in interface StAXContentHandlerendTree in class StAXContentHandlerBasectx - StAX context
StAXContentHandlerBase
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||