Interface TokenHandler
public interface TokenHandler
Handler passed to
TagTokenizer
that will receive callbacks as 'tags' and 'text' are encountered.- Author:
- Joe Walnes
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
shouldProcessTag
(String name) Before attempting to parse a tag, the tokenizer will ask the handler whether the tag should be processed - avoiding additional tag parsing makes the tokenizer quicker.void
Called when tokenizer encounters an HTML tag (open, close or empty).void
Called when tokenizer encounters anything other than a well-formed HTML tag.void
Called when tokenizer encounters something it cannot correctly parse.
-
Method Details
-
shouldProcessTag
Before attempting to parse a tag, the tokenizer will ask the handler whether the tag should be processed - avoiding additional tag parsing makes the tokenizer quicker. If true is returned, the tokenizer will fully parse the tag and pass it into thetag(com.opensymphony.module.sitemesh.html.Tag)
method. If false is returned, the tokenizer will not try to parse the tag and pass it to the #text(com.opensymphony.module.sitemesh.html.Text)
method, untouched. -
tag
Called when tokenizer encounters an HTML tag (open, close or empty). The Tag instance passed in should not be kept beyond the scope of this method as the tokenizer will attempt to reuse it. -
text
Called when tokenizer encounters anything other than a well-formed HTML tag. The Text object is used instead of a String to allow the String to be lazy-loaded. The Text instance passed in should not be kept beyond the scope of this method as the tokenizer will attempt to reuse it. -
warning
Called when tokenizer encounters something it cannot correctly parse. Typically the parsing will continue and the unparseable will be treated as a plain text block, however this callback provides indication of this.- Parameters:
message
- Error messageline
- Line number in input that error occuredcolumn
- Column number in input that error occured
-