|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.xml.dom.DocumentWalker
public class DocumentWalker
Walks through a document, handing the elements matched by a
NodeFilter
over to an
ElementProcessor
.
The textual contents of the document are tokenized; the resulting tokens
are stored in a multi-set (Bag
).
Constructor Summary | |
---|---|
DocumentWalker(NodeFilter filter,
ElementProcessor processor,
TokenizerFactory tFactory)
Creates a new instance. |
Method Summary | |
---|---|
String |
toString()
Returns a string representation of this object. |
void |
walk(Document document,
ContextMap context)
Walks through the contents of an XML document, tokenizing the textual contents. |
protected void |
walk(Element element,
TokenContainer tokenContainer,
ContextMap context)
Walks through the contents of a node, tokenizing textual contents and recursing through nested elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DocumentWalker(NodeFilter filter, ElementProcessor processor, TokenizerFactory tFactory)
filter
- a filter used to decide which elements to hand over to the
element processorprocessor
- used to process the elements selected by the filtertFactory
- used to instantiate tokenizersMethod Detail |
---|
public final void walk(Document document, ContextMap context) throws IOException, ProcessingException
TokenContainer
.
document
- the document to walk throughcontext
- a map of objects that are made available for processing;
might be null
if not requred by the element processor
IOException
- might be thrown by the element processor
ProcessingException
- might be thrown by the element processorprotected void walk(Element element, TokenContainer tokenContainer, ContextMap context) throws IOException, ProcessingException
TokenContainer.getLast()
. For other elements,
the textual contents are stored and child elements are walked through
and matched recursively.
A successful match stops recursion, i.e. child elements of a matching element are never handed over to the node filter for testing (in the case, only the textual contents are recursively collected).
element
- the element to walk throughtokenContainer
- container storing all tokenscontext
- a map of objects that are made available for processing;
might be null
if not required by the element processor
IOException
- might be thrown by the element processor
ProcessingException
- might be thrown by the element processorpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |