org.attoparser.markup
Class AbstractDetailedMarkupAttoHandler

Object
  extended by org.attoparser.AbstractAttoHandler
      extended by org.attoparser.markup.AbstractBasicMarkupAttoHandler
          extended by org.attoparser.markup.AbstractDetailedMarkupAttoHandler
All Implemented Interfaces:
IAttoHandler, ITimedDocumentHandling, IAttributeSequenceHandling, IBasicDocTypeHandling, IBasicElementHandling, ICDATASectionHandling, ICommentHandling, IDetailedDocTypeHandling, IDetailedElementHandling, IProcessingInstructionHandling, IXmlDeclarationHandling
Direct Known Subclasses:
AbstractDetailedNonValidatingHtmlAttoHandler, AbstractDetailedXmlAttoHandler, AbstractStandardMarkupAttoHandler, DuplicatingDetailedMarkupAttoHandler, TextTracingDetailedMarkupAttoHandler, TracingDetailedMarkupAttoHandler

public abstract class AbstractDetailedMarkupAttoHandler
extends AbstractBasicMarkupAttoHandler
implements IDetailedElementHandling, IDetailedDocTypeHandling

Base abstract implementations for markup-specialized attohandlers that not only differentiate among the different types of markup structures (as its superclass AbstractBasicMarkupAttoHandler does), but also divide both elements (tags) and DOCTYPE clauses into its components, lauching different events for them.

Handlers extending from this class can make use of a MarkupParsingConfiguration instance specifying a set of restrictions to be applied during document parsing (for example, for ensuring that a document is well-formed from an XML/XHTML standpoint).

As for structures, this implementation differentiates among:

Unclosed elements are balanced by means of the handleBalanced* handler methods.

This class provides empty implementations for all event handlers, so that subclasses can override only the methods they need.

Since:
1.0
Author:
Daniel Fernández

Constructor Summary
protected AbstractDetailedMarkupAttoHandler()
           
protected AbstractDetailedMarkupAttoHandler(MarkupParsingConfiguration markupParsingConfiguration)
           
 
Method Summary
 void handleAttribute(char[] buffer, int nameOffset, int nameLen, int nameLine, int nameCol, int operatorOffset, int operatorLen, int operatorLine, int operatorCol, int valueContentOffset, int valueContentLen, int valueOuterOffset, int valueOuterLen, int valueLine, int valueCol)
           Called when an attribute is found.
 void handleAutoCloseElementEnd(int line, int col)
           Called for signaling the end of an auto-close element, created for balancing an unclosed tag.
 void handleAutoCloseElementStart(char[] buffer, int nameOffset, int nameLen, int line, int col)
           Called for signaling the start of an auto-close element (a synthetic close tag), created for balancing an unclosed tag.
 void 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.
 void handleCloseElementEnd(int line, int col)
           Called when the end of a close element (a close tag) is found.
 void handleCloseElementStart(char[] buffer, int nameOffset, int nameLen, int line, int col)
           Called when the start of a close element (a close tag) is found.
 void handleDocType(char[] buffer, int contentOffset, int contentLen, int outerOffset, int outerLen, int line, int col)
           Called when a DOCTYPE clause is found.
 void handleDocType(char[] buffer, int keywordOffset, int keywordLen, int keywordLine, int keywordCol, int elementNameOffset, int elementNameLen, int elementNameLine, int elementNameCol, int typeOffset, int typeLen, int typeLine, int typeCol, int publicIdOffset, int publicIdLen, int publicIdLine, int publicIdCol, int systemIdOffset, int systemIdLen, int systemIdLine, int systemIdCol, int internalSubsetOffset, int internalSubsetLen, int internalSubsetLine, int internalSubsetCol, int outerOffset, int outerLen, int outerLine, int outerCol)
           Called when a DOCTYPE clause is found.
 void handleDocumentEnd(long endTimeNanos, long totalTimeNanos, int line, int col)
           Called at the end of document parsing, adding timing information.
 void handleDocumentEnd(long endTimeNanos, long totalTimeNanos, int line, int col, MarkupParsingConfiguration documentRestrictions)
           Called when document parsing ends.
 void handleDocumentStart(long startTimeNanos, int line, int col)
           Called at the beginning of document parsing, adding timing information.
 void handleDocumentStart(long startTimeNanos, int line, int col, MarkupParsingConfiguration documentRestrictions)
           Called when document parsing starts.
 void handleInnerWhiteSpace(char[] buffer, int offset, int len, int line, int col)
           Called when an amount of white space is found inside an element.
 void 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.
 void handleOpenElementEnd(int line, int col)
           Called when the end of an open element (an open tag) is found.
 void handleOpenElementStart(char[] buffer, int nameOffset, int nameLen, int line, int col)
           Called when an open element (an open tag) is found.
 void 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.
 void handleStandaloneElementEnd(int line, int col)
           Called when the end of a standalone element (a minimized tag) is found
 void handleStandaloneElementStart(char[] buffer, int nameOffset, int nameLen, int line, int col)
           Called when a standalone element (a minimized tag) is found.
 void handleUnmatchedCloseElementEnd(int line, int col)
           Called when the end of an unmatched close element (close tag) is found.
 void handleUnmatchedCloseElementStart(char[] buffer, int nameOffset, int nameLen, int line, int col)
           Called when the start of an unmatched close element (close tag) is found.
 void handleXmlDeclaration(char[] buffer, int keywordOffset, int keywordLen, int keywordLine, int keywordCol, int versionOffset, int versionLen, int versionLine, int versionCol, int encodingOffset, int encodingLen, int encodingLine, int encodingCol, int standaloneOffset, int standaloneLen, int standaloneLine, int standaloneCol, int outerOffset, int outerLen, int line, int col)
           Called when a XML Declaration is found.
 void handleXmlDeclarationDetail(char[] buffer, int keywordOffset, int keywordLen, int keywordLine, int keywordCol, int versionOffset, int versionLen, int versionLine, int versionCol, int encodingOffset, int encodingLen, int encodingLine, int encodingCol, int standaloneOffset, int standaloneLen, int standaloneLine, int standaloneCol, int outerOffset, int outerLen, int line, int col)
           Called when a XML Declaration is found when using a handler extending from AbstractDetailedMarkupAttoHandler.
 
Methods inherited from class org.attoparser.markup.AbstractBasicMarkupAttoHandler
handleCDATASection, handleComment, handleProcessingInstruction, handleStructure
 
Methods inherited from class org.attoparser.AbstractAttoHandler
getEndTimeNanos, getStartTimeNanos, getTotalTimeNanos, handleDocumentEnd, handleDocumentStart, handleText
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDetailedMarkupAttoHandler

protected AbstractDetailedMarkupAttoHandler()

AbstractDetailedMarkupAttoHandler

protected AbstractDetailedMarkupAttoHandler(MarkupParsingConfiguration markupParsingConfiguration)
Method Detail

handleDocumentStart

public final void handleDocumentStart(long startTimeNanos,
                                      int line,
                                      int col)
                               throws AttoParseException
Description copied from interface: ITimedDocumentHandling

Called at the beginning of document parsing, adding timing information.

Specified by:
handleDocumentStart in interface ITimedDocumentHandling
Overrides:
handleDocumentStart in class AbstractAttoHandler
Parameters:
startTimeNanos - the current time (in nanoseconds) obtained when parsing starts.
line - the line of the document where parsing starts (usually number 1)
col - the column of the document where parsing starts (usually number 1)
Throws:
AttoParseException

handleDocumentEnd

public final void handleDocumentEnd(long endTimeNanos,
                                    long totalTimeNanos,
                                    int line,
                                    int col)
                             throws AttoParseException
Description copied from interface: ITimedDocumentHandling

Called at the end of document parsing, adding timing information.

Specified by:
handleDocumentEnd in interface ITimedDocumentHandling
Overrides:
handleDocumentEnd in class AbstractAttoHandler
Parameters:
endTimeNanos - the current time (in nanoseconds) obtained when parsing ends.
totalTimeNanos - the difference between current times at the start and end of parsing (in nanoseconds)
line - the line of the document where parsing ends (usually the last one)
col - the column of the document where the parsing ends (usually the last one)
Throws:
AttoParseException

handleXmlDeclaration

public final void handleXmlDeclaration(char[] buffer,
                                       int keywordOffset,
                                       int keywordLen,
                                       int keywordLine,
                                       int keywordCol,
                                       int versionOffset,
                                       int versionLen,
                                       int versionLine,
                                       int versionCol,
                                       int encodingOffset,
                                       int encodingLen,
                                       int encodingLine,
                                       int encodingCol,
                                       int standaloneOffset,
                                       int standaloneLen,
                                       int standaloneLine,
                                       int standaloneCol,
                                       int outerOffset,
                                       int outerLen,
                                       int line,
                                       int col)
                                throws AttoParseException
Description copied from interface: IXmlDeclarationHandling

Called when a XML Declaration is found.

Five [offset, len] pairs are provided for five partitions (outer, keyword, version, encoding and standalone):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| [K]          [V]            [ENC]              [S]  |
[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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleXmlDeclaration in interface IXmlDeclarationHandling
Overrides:
handleXmlDeclaration in class AbstractBasicMarkupAttoHandler
Parameters:
buffer - the document buffer (not copied)
keywordOffset - offset for the keyword partition.
keywordLen - length of the keyword partition.
keywordLine - the line in the original document where the keyword partition starts.
keywordCol - the column in the original document where the keyword partition starts.
versionOffset - offset for the version partition.
versionLen - length of the version partition.
versionLine - the line in the original document where the version partition starts.
versionCol - the column in the original document where the version partition starts.
encodingOffset - offset for the encoding partition.
encodingLen - length of the encoding partition.
encodingLine - the line in the original document where the encoding partition starts.
encodingCol - the column in the original document where the encoding partition starts.
standaloneOffset - offset for the standalone partition.
standaloneLen - length of the standalone partition.
standaloneLine - the line in the original document where the standalone partition starts.
standaloneCol - the column in the original document where the standalone partition starts.
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.
Throws:
AttoParseException

handleDocType

public final void handleDocType(char[] buffer,
                                int contentOffset,
                                int contentLen,
                                int outerOffset,
                                int outerLen,
                                int line,
                                int col)
                         throws AttoParseException
Description copied from interface: IBasicDocTypeHandling

Called when a DOCTYPE clause is found.

This method reports the DOCTYPE clause as a whole, not splitting it into its different parts (root element name, publicId, etc.). This splitting should normally be done by implementations of the IDetailedDocTypeHandling interface (like AbstractDetailedMarkupAttoHandler).

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

<!DOCTYPE html PUBLIC "..." "...">
| [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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleDocType in interface IBasicDocTypeHandling
Overrides:
handleDocType in class AbstractBasicMarkupAttoHandler
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.
Throws:
AttoParseException

handleStandaloneElement

public final void handleStandaloneElement(char[] buffer,
                                          int contentOffset,
                                          int contentLen,
                                          int outerOffset,
                                          int outerLen,
                                          int line,
                                          int col)
                                   throws AttoParseException
Description copied from interface: IBasicElementHandling

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleStandaloneElement in interface IBasicElementHandling
Overrides:
handleStandaloneElement in class AbstractBasicMarkupAttoHandler
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.
Throws:
AttoParseException

handleOpenElement

public final void handleOpenElement(char[] buffer,
                                    int contentOffset,
                                    int contentLen,
                                    int outerOffset,
                                    int outerLen,
                                    int line,
                                    int col)
                             throws AttoParseException
Description copied from interface: IBasicElementHandling

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleOpenElement in interface IBasicElementHandling
Overrides:
handleOpenElement in class AbstractBasicMarkupAttoHandler
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.
Throws:
AttoParseException

handleCloseElement

public final void handleCloseElement(char[] buffer,
                                     int contentOffset,
                                     int contentLen,
                                     int outerOffset,
                                     int outerLen,
                                     int line,
                                     int col)
                              throws AttoParseException
Description copied from interface: IBasicElementHandling

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleCloseElement in interface IBasicElementHandling
Overrides:
handleCloseElement in class AbstractBasicMarkupAttoHandler
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.
Throws:
AttoParseException

handleDocumentStart

public void handleDocumentStart(long startTimeNanos,
                                int line,
                                int col,
                                MarkupParsingConfiguration documentRestrictions)
                         throws AttoParseException

Called when document parsing starts.

Parameters:
startTimeNanos - the starting time, in nanoseconds.
documentRestrictions - the document restrictions being applied.
Throws:
AttoParseException

handleDocumentEnd

public void handleDocumentEnd(long endTimeNanos,
                              long totalTimeNanos,
                              int line,
                              int col,
                              MarkupParsingConfiguration documentRestrictions)
                       throws AttoParseException

Called when document parsing ends.

Parameters:
endTimeNanos - the parsing end time, in nanoseconds.
totalTimeNanos - the difference between parsing start and end times.
documentRestrictions - the document restrictions being applied.
Throws:
AttoParseException

handleXmlDeclarationDetail

public void handleXmlDeclarationDetail(char[] buffer,
                                       int keywordOffset,
                                       int keywordLen,
                                       int keywordLine,
                                       int keywordCol,
                                       int versionOffset,
                                       int versionLen,
                                       int versionLine,
                                       int versionCol,
                                       int encodingOffset,
                                       int encodingLen,
                                       int encodingLine,
                                       int encodingCol,
                                       int standaloneOffset,
                                       int standaloneLen,
                                       int standaloneLine,
                                       int standaloneCol,
                                       int outerOffset,
                                       int outerLen,
                                       int line,
                                       int col)
                                throws AttoParseException

Called when a XML Declaration is found when using a handler extending from AbstractDetailedMarkupAttoHandler.

Five [offset, len] pairs are provided for five partitions (outer, keyword, version, encoding and standalone):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| [K]          [V]            [ENC]              [S]  |
[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).

Implementations of this handler should never modify the document buffer.

Parameters:
buffer - the document buffer (not copied)
keywordOffset - offset for the keyword partition.
keywordLen - length of the keyword partition.
keywordLine - the line in the original document where the keyword partition starts.
keywordCol - the column in the original document where the keyword partition starts.
versionOffset - offset for the version partition.
versionLen - length of the version partition.
versionLine - the line in the original document where the version partition starts.
versionCol - the column in the original document where the version partition starts.
encodingOffset - offset for the encoding partition.
encodingLen - length of the encoding partition.
encodingLine - the line in the original document where the encoding partition starts.
encodingCol - the column in the original document where the encoding partition starts.
standaloneOffset - offset for the standalone partition.
standaloneLen - length of the standalone partition.
standaloneLine - the line in the original document where the standalone partition starts.
standaloneCol - the column in the original document where the standalone partition starts.
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.
Throws:
AttoParseException

handleStandaloneElementStart

public void handleStandaloneElementStart(char[] buffer,
                                         int nameOffset,
                                         int nameLen,
                                         int line,
                                         int col)
                                  throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when a standalone element (a minimized tag) is found. The name of the element is also reported.

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleStandaloneElementStart in interface IDetailedElementHandling
Parameters:
buffer - the document buffer (not copied)
nameOffset - the offset (position in buffer) where the element name appears.
nameLen - the length (in chars) of the element name.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Throws:
AttoParseException

handleStandaloneElementEnd

public void handleStandaloneElementEnd(int line,
                                       int col)
                                throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when the end of a standalone element (a minimized tag) is found

Specified by:
handleStandaloneElementEnd in interface IDetailedElementHandling
Parameters:
line - the line in the original document where the element ending structure appears.
col - the column in the original document where the element ending structure appears.
Throws:
AttoParseException

handleOpenElementStart

public void handleOpenElementStart(char[] buffer,
                                   int nameOffset,
                                   int nameLen,
                                   int line,
                                   int col)
                            throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when an open element (an open tag) is found. The name of the element is also reported.

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleOpenElementStart in interface IDetailedElementHandling
Parameters:
buffer - the document buffer (not copied)
nameOffset - the offset (position in buffer) where the element name appears.
nameLen - the length (in chars) of the element name.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Throws:
AttoParseException

handleOpenElementEnd

public void handleOpenElementEnd(int line,
                                 int col)
                          throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when the end of an open element (an open tag) is found.

Specified by:
handleOpenElementEnd in interface IDetailedElementHandling
Parameters:
line - the line in the original document where the element ending structure appears.
col - the column in the original document where the element ending structure appears.
Throws:
AttoParseException

handleCloseElementStart

public void handleCloseElementStart(char[] buffer,
                                    int nameOffset,
                                    int nameLen,
                                    int line,
                                    int col)
                             throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when the start of a close element (a close tag) is found. The name of the element is also reported.

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleCloseElementStart in interface IDetailedElementHandling
Parameters:
buffer - the document buffer (not copied)
nameOffset - the offset (position in buffer) where the element name appears.
nameLen - the length (in chars) of the element name.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Throws:
AttoParseException

handleCloseElementEnd

public void handleCloseElementEnd(int line,
                                  int col)
                           throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when the end of a close element (a close tag) is found.

Specified by:
handleCloseElementEnd in interface IDetailedElementHandling
Parameters:
line - the line in the original document where the element ending structure appears.
col - the column in the original document where the element ending structure appears.
Throws:
AttoParseException

handleAutoCloseElementStart

public void handleAutoCloseElementStart(char[] buffer,
                                        int nameOffset,
                                        int nameLen,
                                        int line,
                                        int col)
                                 throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called for signaling the start of an auto-close element (a synthetic close tag), created for balancing an unclosed tag. The name of the element is also reported.

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleAutoCloseElementStart in interface IDetailedElementHandling
Parameters:
buffer - the document buffer (not copied)
nameOffset - the offset (position in buffer) where the element name appears.
nameLen - the length (in chars) of the element name.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Throws:
AttoParseException

handleAutoCloseElementEnd

public void handleAutoCloseElementEnd(int line,
                                      int col)
                               throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called for signaling the end of an auto-close element, created for balancing an unclosed tag.

Specified by:
handleAutoCloseElementEnd in interface IDetailedElementHandling
Parameters:
line - the line in the original document where the element ending structure appears.
col - the column in the original document where the element ending structure appears.
Throws:
AttoParseException

handleUnmatchedCloseElementStart

public void handleUnmatchedCloseElementStart(char[] buffer,
                                             int nameOffset,
                                             int nameLen,
                                             int line,
                                             int col)
                                      throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when the start of an unmatched close element (close tag) is found. The name of the element is also reported.

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleUnmatchedCloseElementStart in interface IDetailedElementHandling
Parameters:
buffer - the document buffer (not copied)
nameOffset - the offset (position in buffer) where the element name appears.
nameLen - the length (in chars) of the element name.
line - the line in the original document where this artifact starts.
col - the column in the original document where this artifact starts.
Throws:
AttoParseException

handleUnmatchedCloseElementEnd

public void handleUnmatchedCloseElementEnd(int line,
                                           int col)
                                    throws AttoParseException
Description copied from interface: IDetailedElementHandling

Called when the end of an unmatched close element (close tag) is found.

Specified by:
handleUnmatchedCloseElementEnd in interface IDetailedElementHandling
Parameters:
line - the line in the original document where the element ending structure appears.
col - the column in the original document where the element ending structure appears.
Throws:
AttoParseException

handleAttribute

public void handleAttribute(char[] buffer,
                            int nameOffset,
                            int nameLen,
                            int nameLine,
                            int nameCol,
                            int operatorOffset,
                            int operatorLen,
                            int operatorLine,
                            int operatorCol,
                            int valueContentOffset,
                            int valueContentLen,
                            int valueOuterOffset,
                            int valueOuterLen,
                            int valueLine,
                            int valueCol)
                     throws AttoParseException
Description copied from interface: IAttributeSequenceHandling

Called when an attribute is found.

Three [offset, len] pairs are provided for three partitions (name, operator, valueContent and valueOuter):

class="basic_column"
[NAM]* [VALUECONTE]| (*) = [OPERATOR]
|     [VALUEOUTER--]
[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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleAttribute in interface IAttributeSequenceHandling
Parameters:
buffer - the document buffer (not copied)
nameOffset - offset for the name partition.
nameLen - length of the name partition.
nameLine - the line in the original document where the name partition starts.
nameCol - the column in the original document where the name partition starts.
operatorOffset - offset for the operator partition.
operatorLen - length of the operator partition.
operatorLine - the line in the original document where the operator partition starts.
operatorCol - the column in the original document where the operator partition starts.
valueContentOffset - offset for the valueContent partition.
valueContentLen - length of the valueContent partition.
valueOuterOffset - offset for the valueOuter partition.
valueOuterLen - length of the valueOuter partition.
valueLine - the line in the original document where the value (outer) partition starts.
valueCol - the column in the original document where the value (outer) partition starts.
Throws:
AttoParseException

handleInnerWhiteSpace

public void handleInnerWhiteSpace(char[] buffer,
                                  int offset,
                                  int len,
                                  int line,
                                  int col)
                           throws AttoParseException
Description copied from interface: IAttributeSequenceHandling

Called when an amount of white space is found inside an element.

This attribute separators can contain any amount of whitespace, including line feeds:

<div id="main"        class="basic_column">
              [ATTSEP]

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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleInnerWhiteSpace in interface IAttributeSequenceHandling
Parameters:
buffer - the document buffer (not copied)
offset - offset for the artifact.
len - length of the artifact.
line - the line in the original document where the artifact starts.
col - the column in the original document where the artifact starts.
Throws:
AttoParseException

handleDocType

public void handleDocType(char[] buffer,
                          int keywordOffset,
                          int keywordLen,
                          int keywordLine,
                          int keywordCol,
                          int elementNameOffset,
                          int elementNameLen,
                          int elementNameLine,
                          int elementNameCol,
                          int typeOffset,
                          int typeLen,
                          int typeLine,
                          int typeCol,
                          int publicIdOffset,
                          int publicIdLen,
                          int publicIdLine,
                          int publicIdCol,
                          int systemIdOffset,
                          int systemIdLen,
                          int systemIdLine,
                          int systemIdCol,
                          int internalSubsetOffset,
                          int internalSubsetLen,
                          int internalSubsetLine,
                          int internalSubsetCol,
                          int outerOffset,
                          int outerLen,
                          int outerLine,
                          int outerCol)
                   throws AttoParseException
Description copied from interface: IDetailedDocTypeHandling

Called when a DOCTYPE clause is found.

This method reports the DOCTYPE clause splitting it into its different parts.

Seven [offset, len] pairs are provided for seven partitions (outer, keyword, elementName, type, publicId, systemId and internalSubset) of the DOCTYPE clause:

<!DOCTYPE html PUBLIC ".........." ".........." [................]>
| [KEYWO] [EN] [TYPE]  [PUBLICID]   [SYSTEMID]   [INTERNALSUBSET] |
[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).

Implementations of this handler should never modify the document buffer.

Specified by:
handleDocType in interface IDetailedDocTypeHandling
Parameters:
buffer - the document buffer (not copied)
keywordOffset - offset for the keyword partition.
keywordLen - length of the keyword partition.
keywordLine - the line in the original document where the keyword partition starts.
keywordCol - the column in the original document where the keyword partition starts.
elementNameOffset - offset for the elementName partition.
elementNameLen - length of the elementName partition.
elementNameLine - the line in the original document where the elementName partition starts.
elementNameCol - the column in the original document where the elementName partition starts.
typeOffset - offset for the type partition.
typeLen - length of the type partition.
typeLine - the line in the original document where the type partition starts.
typeCol - the column in the original document where the type partition starts.
publicIdOffset - offset for the publicId partition.
publicIdLen - length of the publicId partition.
publicIdLine - the line in the original document where the publicId partition starts.
publicIdCol - the column in the original document where the publicId partition starts.
systemIdOffset - offset for the systemId partition.
systemIdLen - length of the systemId partition.
systemIdLine - the line in the original document where the systemId partition starts.
systemIdCol - the column in the original document where the systemId partition starts.
internalSubsetOffset - offset for the internalSubsetId partition.
internalSubsetLen - length of the internalSubsetId partition.
internalSubsetLine - the line in the original document where the internalSubsetId partition starts.
internalSubsetCol - the column in the original document where the internalSubsetId partition starts.
outerOffset - offset for the outer partition.
outerLen - length of the outer partition.
outerLine - the line in the original document where this artifact starts.
outerCol - the column in the original document where this artifact starts.
Throws:
AttoParseException


Copyright © 2013 The ATTOPARSER team. All Rights Reserved.