org.attoparser.markup
Interface IBasicElementHandling

All Known Implementing Classes:
AbstractBasicMarkupAttoHandler, AbstractDetailedMarkupAttoHandler, AbstractDetailedNonValidatingHtmlAttoHandler, AbstractDetailedXmlAttoHandler, AbstractStandardMarkupAttoHandler, AbstractStandardNonValidatingHtmlAttoHandler, AbstractStandardXmlAttoHandler, DOMXmlAttoHandler, DuplicatingBasicMarkupAttoHandler, DuplicatingDetailedMarkupAttoHandler, HtmlCodeDisplayAttoHandler, TextTracingBasicMarkupAttoHandler, TextTracingDetailedHtmlAttoHandler, TextTracingDetailedMarkupAttoHandler, TextTracingStandardMarkupAttoHandler, TracingDetailedHtmlAttoHandler, TracingDetailedMarkupAttoHandler

public interface IBasicElementHandling

Handler feature interface to be implemented by IAttoHandler implementations that offer basic (non-detailed) reporting of elements (markup tags).

Since:
1.0
Author:
Daniel Fernández

Method Summary
 char[] handleCloseElement(char[] buffer, int contentOffset, int contentLen, int outerOffset, int outerLen, int line, int col)
           Called when a close element (a close tag) is found.
 char[] handleOpenElement(char[] buffer, int contentOffset, int contentLen, int outerOffset, int outerLen, int line, int col)
           Called when an open element (an open tag) is found.
 char[] handleStandaloneElement(char[] buffer, int contentOffset, int contentLen, int outerOffset, int outerLen, int line, int col)
           Called when a standalone element (a minimized tag) is found.
 

Method Detail

handleStandaloneElement

char[] handleStandaloneElement(char[] buffer,
                               int contentOffset,
                               int contentLen,
                               int outerOffset,
                               int outerLen,
                               int line,
                               int col)
                               throws AttoParseException

Called when a standalone element (a minimized tag) is found.

This method reports the element as a whole, not splitting it among its different parts (element name, attributes). This splitting should normally be done by implementations of the IDetailedElementHandling interface (like AbstractDetailedMarkupAttoHandler).

Two [offset, len] pairs are provided for two partitions (outer and content) of the element:

<img src="/images/logo.png"/>
|[CONTENT-----------------] |
[OUTER----------------------]

Artifacts are reported using the document buffer directly, and this buffer should not be considered to be immutable, so reported structures should be copied if they need to be stored (either by copying len chars from the buffer char[] starting in offset or by creating a String from it using the same specification).

This method will return a char[] if, as a result of handling this element, parsing should be disabled until the returned char sequence is found in input. This allows e.g. ignoring the contents of non-processable elements like HTML's <script> or <style>.

Implementations of this handler should never modify the document buffer.

Parameters:
buffer - the document buffer (not copied)
contentOffset - offset for the content partition.
contentLen - length of the content partition.
outerOffset - offset for the outer partition.
outerLen - length of the outer partition.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Returns:
will return a char[] if, as a result of handling this structure, parsing should be disabled until the returned char sequence is found in input. Will return null if parsing should not be disabled (most common case).
Throws:
AttoParseException

handleOpenElement

char[] handleOpenElement(char[] buffer,
                         int contentOffset,
                         int contentLen,
                         int outerOffset,
                         int outerLen,
                         int line,
                         int col)
                         throws AttoParseException

Called when an open element (an open tag) is found.

This method reports the element as a whole, not splitting it among its different parts (element name, attributes). This splitting should normally be done by implementations of the IDetailedElementHandling interface (like AbstractDetailedMarkupAttoHandler).

Two [offset, len] pairs are provided for two partitions (outer and content) of the element:

<div class="main_section">
|[CONTENT---------------]|
[OUTER-------------------]

Artifacts are reported using the document buffer directly, and this buffer should not be considered to be immutable, so reported structures should be copied if they need to be stored (either by copying len chars from the buffer char[] starting in offset or by creating a String from it using the same specification).

This method will return a char[] if, as a result of handling this element, parsing should be disabled until the returned char sequence is found in input. This allows e.g. ignoring the contents of non-processable elements like HTML's <script> or <style>.

Implementations of this handler should never modify the document buffer.

Parameters:
buffer - the document buffer (not copied)
contentOffset - offset for the content partition.
contentLen - length of the content partition.
outerOffset - offset for the outer partition.
outerLen - length of the outer partition.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Returns:
will return a char[] if, as a result of handling this structure, parsing should be disabled until the returned char sequence is found in input. Will return null if parsing should not be disabled (most common case).
Throws:
AttoParseException

handleCloseElement

char[] handleCloseElement(char[] buffer,
                          int contentOffset,
                          int contentLen,
                          int outerOffset,
                          int outerLen,
                          int line,
                          int col)
                          throws AttoParseException

Called when a close element (a close tag) is found.

This method reports the element as a whole, not splitting it among its different parts (element name). This splitting should normally be done by implementations of the IDetailedElementHandling interface (like AbstractDetailedMarkupAttoHandler).

Two [offset, len] pairs are provided for two partitions (outer and content) of the element:

</div>
| [C]|
[OUTE]

Artifacts are reported using the document buffer directly, and this buffer should not be considered to be immutable, so reported structures should be copied if they need to be stored (either by copying len chars from the buffer char[] starting in offset or by creating a String from it using the same specification).

This method will return a char[] if, as a result of handling this element, parsing should be disabled until the returned char sequence is found in input. This allows e.g. ignoring the contents of non-processable elements like HTML's <script> or <style>.

Implementations of this handler should never modify the document buffer.

Parameters:
buffer - the document buffer (not copied)
contentOffset - offset for the content partition.
contentLen - length of the content partition.
outerOffset - offset for the outer partition.
outerLen - length of the outer partition.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Returns:
will return a char[] if, as a result of handling this structure, parsing should be disabled until the returned char sequence is found in input. Will return null if parsing should not be disabled (most common case).
Throws:
AttoParseException


Copyright © 2014 The ATTOPARSER team. All Rights Reserved.