org.archive.wayback.util.htmllex
Class ParseEventDelegator
java.lang.Object
org.archive.wayback.util.htmllex.ParseEventDelegator
- All Implemented Interfaces:
- ParseEventHandler
public class ParseEventDelegator
- extends Object
- implements ParseEventHandler
This class provides an abstraction between high-level SAX events, and
application specific low-level SAX event handlers.
Any object which wishes to receive any low-level SAX events is placed in the
parserVisitors List, and at initialization of this class, each element in
that list is given an opportunity to register to receive whatever low-level
SAX events it is interested in.
This class also manages casting of Node objects into more event-specific
casts, and uses the ParseContext to route specific nodes to the registered
handlers of each low-level event types.
This class attempts to be efficient about targeting specific TagNodes:
When registering to receive events, handlers can register for a specific
tag name, or for the global-tag ("*") name.
As TagNodes are handled, all tag-specific handlers are called, followed by
all global-tag handlers.
- Author:
- brad
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WILDCARD_TAG_NAME
public static final String WILDCARD_TAG_NAME
- See Also:
- Constant Field Values
ParseEventDelegator
public ParseEventDelegator()
init
public void init()
handleNode
public void handleNode(ParseContext context,
org.htmlparser.Node node)
throws IOException
- Specified by:
handleNode in interface ParseEventHandler
- Throws:
IOException
addCloseTagHandler
public void addCloseTagHandler(CloseTagHandler v)
addCloseTagHandler
public void addCloseTagHandler(CloseTagHandler v,
String name)
handleCloseTagNode
public void handleCloseTagNode(ParseContext context,
org.htmlparser.nodes.TagNode node)
throws IOException
- Throws:
IOException
addOpenTagHandler
public void addOpenTagHandler(OpenTagHandler v)
addOpenTagHandler
public void addOpenTagHandler(OpenTagHandler v,
String name)
handleOpenTagNode
public void handleOpenTagNode(ParseContext context,
org.htmlparser.nodes.TagNode node)
throws IOException
- Throws:
IOException
addCSSTextHandler
public void addCSSTextHandler(CSSTextHandler v)
handleCSSTextNode
public void handleCSSTextNode(ParseContext context,
org.htmlparser.nodes.TextNode node)
throws IOException
- Throws:
IOException
addJSTextHandler
public void addJSTextHandler(JSTextHandler v)
handleJSTextNode
public void handleJSTextNode(ParseContext context,
org.htmlparser.nodes.TextNode node)
throws IOException
- Throws:
IOException
addRemarkTextHandler
public void addRemarkTextHandler(RemarkTextHandler v)
handleRemarkTextNode
public void handleRemarkTextNode(ParseContext context,
org.htmlparser.nodes.RemarkNode node)
throws IOException
- Throws:
IOException
addContentTextHandler
public void addContentTextHandler(ContentTextHandler v)
handleContentTextNode
public void handleContentTextNode(ParseContext context,
org.htmlparser.nodes.TextNode node)
throws IOException
- Throws:
IOException
addParseCompleteHandler
public void addParseCompleteHandler(ParseCompleteHandler v)
handleParseComplete
public void handleParseComplete(ParseContext context)
throws IOException
- Specified by:
handleParseComplete in interface ParseEventHandler
- Throws:
IOException
getParserVisitors
public List<ParseEventDelegatorVisitor> getParserVisitors()
- Returns:
- the parserVisitors
setParserVisitors
public void setParserVisitors(List<ParseEventDelegatorVisitor> parserVisitors)
- Parameters:
parserVisitors - the parserVisitors to set
Copyright © 2005-2011 Internet Archive. All Rights Reserved.