Class DebugCallbackDecorator
- java.lang.Object
-
- it.unimi.dsi.parser.callback.DebugCallbackDecorator
-
-
Field Summary
-
Fields inherited from interface it.unimi.dsi.parser.callback.Callback
EMPTY_CALLBACK_ARRAY
-
-
Constructor Summary
Constructors Constructor Description DebugCallbackDecorator(Callback callback)
-
Method Summary
Modifier and Type Method Description booleancdata(Element element, char[] text, int offset, int length)Receive notification of the content of a CDATA section.booleancharacters(char[] text, int offset, int length, boolean flowBroken)Receive notification of character data inside an element.voidconfigure(BulletParser parser)Configure the parser for usage with this callback.voidendDocument()Receive notification of the end of the document.booleanendElement(Element element)Receive notification of the end of an element.booleanequals(Object obj)inthashCode()voidstartDocument()Receive notification of the beginning of the document.booleanstartElement(Element element, Map<Attribute,MutableString> attrMap)Receive notification of the start of an element.StringtoString()
-
-
-
Constructor Detail
-
DebugCallbackDecorator
public DebugCallbackDecorator(Callback callback)
-
-
Method Detail
-
cdata
public boolean cdata(Element element, char[] text, int offset, int length)
Description copied from interface:CallbackReceive notification of the content of a CDATA section.CDATA sections in an HTML document are the result of meeting a
STYLEorSCRIPTelement. In that case, the element will be passed as first argument.You must not write into
text, as it could be passed around to many callbacks.- Specified by:
cdatain interfaceCallback- Parameters:
element- the element enclosing the CDATA section, ornullif the CDATA section was created with explicit markup.text- an array containing the character data.offset- the start position in the array.length- the number of characters to read from the array.- Returns:
- true to keep the parser parsing, false to stop it.
-
characters
public boolean characters(char[] text, int offset, int length, boolean flowBroken)Description copied from interface:CallbackReceive notification of character data inside an element.You must not write into
text, as it could be passed around to many callbacks.flowBrokenwill be true iff the flow was broken beforetext. This feature makes it possible to extract quickly the text in a document without looking at the elements.- Specified by:
charactersin interfaceCallback- Parameters:
text- an array containing the character data.offset- the start position in the array.length- the number of characters to read from the array.flowBroken- whether the flow is broken at the start oftext.- Returns:
- true to keep the parser parsing, false to stop it.
-
configure
public void configure(BulletParser parser)
Description copied from interface:CallbackConfigure the parser for usage with this callback.When a callback is registered with a parser, it needs to set up the parser so that all data required by the callback is actually parsed. The configuration must be a monotone process—you can only set properties and add attribute types to be parsed.
-
endDocument
public void endDocument()
Description copied from interface:CallbackReceive notification of the end of the document.- Specified by:
endDocumentin interfaceCallback
-
endElement
public boolean endElement(Element element)
Description copied from interface:CallbackReceive notification of the end of an element. Warning: unless specific decorators are used, in general a callback will just receive notifications for elements whose closing tag appears explicitly in the document.This method will never be called for element without closing tags, even if such a tag is found.
- Specified by:
endElementin interfaceCallback- Parameters:
element- the element whose closing tag was found.- Returns:
- true to keep the parser parsing, false to stop it.
-
startDocument
public void startDocument()
Description copied from interface:CallbackReceive notification of the beginning of the document.The callback must use this method to reset its internal state so that it can be resued. It must be safe to invoke this method several times.
- Specified by:
startDocumentin interfaceCallback
-
startElement
public boolean startElement(Element element, Map<Attribute,MutableString> attrMap)
Description copied from interface:CallbackReceive notification of the start of an element.For simple elements, this is the only notification that the callback will ever receive.
- Specified by:
startElementin interfaceCallback- Parameters:
element- the element whose opening tag was found.attrMap- a map fromAttributes toMutableStrings.- Returns:
- true to keep the parser parsing, false to stop it.
-
-