Package nu.validator.htmlparser.common
Interface TokenHandler
- All Known Implementing Classes:
CoalescingTreeBuilder,DOMTreeBuilder,SAXStreamer,SAXTreeBuilder,TreeBuilder,XOMTreeBuilder
public interface TokenHandler
Tokenizer reports tokens through this interface.- Version:
- $Id$
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the CDATA sections are allowed.voidcharacters(char[] buf, int start, int length) Receive character tokens.voidcomment(char[] buf, int start, int length) Receive a comment token.voidReceive a doctype token.voidendTag(ElementName eltName) Receive an end tag token.voidThe perform final cleanup.voideof()The end-of-file token.voidstartTag(ElementName eltName, HtmlAttributes attributes, boolean selfClosing) Receive a start tag token.voidstartTokenization(Tokenizer self) This method is called at the start of tokenization before any other methods on this interface are called.booleanIf this handler implementation cares about comments, returntrue.voidReports a U+0000 that's being turned into a U+FFFD.
-
Method Details
-
startTokenization
This method is called at the start of tokenization before any other methods on this interface are called. Implementations should hold the reference to theTokenizerin order to set the content model flag and in order to be able to query forLocatordata.- Parameters:
self- theTokenizer.- Throws:
SAXException- if something went wrong
-
wantsComments
If this handler implementation cares about comments, returntrue. If not, returnfalse.- Returns:
- whether this handler wants comments
- Throws:
SAXException- if something went wrong
-
doctype
void doctype(String name, String publicIdentifier, String systemIdentifier, boolean forceQuirks) throws SAXException Receive a doctype token.- Parameters:
name- the namepublicIdentifier- the public idsystemIdentifier- the system idforceQuirks- whether the token is correct- Throws:
SAXException- if something went wrong
-
startTag
void startTag(ElementName eltName, HtmlAttributes attributes, boolean selfClosing) throws SAXException Receive a start tag token.- Parameters:
eltName- the tag nameattributes- the attributesselfClosing- TODO- Throws:
SAXException- if something went wrong
-
endTag
Receive an end tag token.- Parameters:
eltName- the tag name- Throws:
SAXException- if something went wrong
-
comment
Receive a comment token. The data is junk if thewantsComments()returnedfalse.- Parameters:
buf- a buffer holding the datastart- the offset into the bufferlength- the number of code units to read- Throws:
SAXException- if something went wrong
-
characters
Receive character tokens. This method has the same semantics as the SAX method of the same name.- Parameters:
buf- a buffer holding the datastart- offset into the bufferlength- the number of code units to read- Throws:
SAXException- if something went wrong- See Also:
-
zeroOriginatingReplacementCharacter
Reports a U+0000 that's being turned into a U+FFFD.- Throws:
SAXException- if something went wrong
-
eof
The end-of-file token.- Throws:
SAXException- if something went wrong
-
endTokenization
The perform final cleanup.- Throws:
SAXException- if something went wrong
-
cdataSectionAllowed
Checks if the CDATA sections are allowed.- Returns:
trueif CDATA sections are allowed- Throws:
SAXException- if something went wrong
-