Interface TagHandler
-
- All Known Implementing Classes:
AbstractTagHandler,CanvasComponentTagHandler,DefaultComponentTagHandler,DefaultTagHandler,HeadTagHandler,IFrameTagHandler,ImageComponentTagHandler,ImgTagHandler,InlineScriptTagHandler,LinkTagHandler,MetaTagHandler,NonScriptTagHandler,ParsysComponentTagHandler,ScriptTagHandler,StyleTagHandler,TextComponentTagHandler,TitleComponentTagHandler,TitleTagHandler
public interface TagHandlerInterface for handling HTML tags in the input HTML document. The tag handlers are registered with theTagHandlerProvideraccording to tag/attribute matching rules and receive callbacks from theHTMLContentHandlerwhile it is handling the SAX events.Tag Handlers work in a chain of responsibility with each tag handler creating a new instance of a nested tag handler and delegating to it. Majority of the tag handlers don't have a standalone existence and work nested within other tag handlers. The tag handlers which are capable of working stand alone need to implement this interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbeginHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)Callback to signal the start of handling giving the tag handler a chance for running intialization routines.voidcharacters(char[] ch, int start, int length)Callback to signal the encounter of character content within tags.voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)Callback to signal the encounter of a tag end.voidendHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName)Callback to signal the end of handling giving the tag handler a chance for finalizing things.voidsetDesignImporterContext(DesignImporterContext designImporterContext)Sets the design importer contextvoidsetTagHandlerProvider(TagHandlerProvider tagHandlerProvider)voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)Callback to signal the encounter of a tag start.
-
-
-
Method Detail
-
beginHandling
void beginHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws DesignImportExceptionCallback to signal the start of handling giving the tag handler a chance for running intialization routines.TagHandlers are registered against tag+attribute combination and are invoked by theHTMLContentHandleras and when it encounters a tag matching the tag attribute combination the tag handler is registered with.- Parameters:
uri-localName-qName-atts-- Throws:
DesignImportException
-
characters
void characters(char[] ch, int start, int length) throws DesignImportExceptionCallback to signal the encounter of character content within tags.- Parameters:
ch-start-length-- Throws:
org.xml.sax.SAXExceptionDesignImportException
-
endElement
void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws DesignImportExceptionCallback to signal the encounter of a tag end.- Parameters:
uri-localName-qName-- Throws:
org.xml.sax.SAXExceptionDesignImportException
-
endHandling
void endHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws DesignImportExceptionCallback to signal the end of handling giving the tag handler a chance for finalizing things.This is arguably the last callback a tag handler receives. After this, the current tag handler is popped out from the chain and the subsequent Tika events are directed to preceding tag handlers.
- Parameters:
uri-localName-qName-- Throws:
DesignImportException
-
setDesignImporterContext
void setDesignImporterContext(DesignImporterContext designImporterContext)
Sets the design importer context- Parameters:
designImporterContext-
-
setTagHandlerProvider
void setTagHandlerProvider(TagHandlerProvider tagHandlerProvider)
-
startElement
void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws DesignImportExceptionCallback to signal the encounter of a tag start.Once a tag handler begins handling, it receives the start tag events for all the nested tags within the purview of the tag this tag handler is registered against.
- Parameters:
uri-localName-qName-atts-- Throws:
org.xml.sax.SAXExceptionDesignImportException
-
-