|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Objectorg.attoparser.AbstractAttoHandler
org.attoparser.markup.AbstractBasicMarkupAttoHandler
org.attoparser.markup.AbstractDetailedMarkupAttoHandler
org.attoparser.markup.AbstractStandardMarkupAttoHandler
org.attoparser.markup.trace.TextTracingStandardMarkupAttoHandler
public final class TextTracingStandardMarkupAttoHandler
| Constructor Summary | |
|---|---|
TextTracingStandardMarkupAttoHandler(Writer writer)
|
|
TextTracingStandardMarkupAttoHandler(Writer writer,
MarkupParsingConfiguration markupParsingConfiguration)
|
|
| Method Summary | |
|---|---|
void |
handleAutoClosedElement(String elementName,
int line,
int col)
Called when a close element (a close tag) is needed in order to correctly balance the markup. |
void |
handleCDATASection(char[] buffer,
int offset,
int len,
int line,
int col)
Called when a CDATA section is found. |
void |
handleCloseElement(String elementName,
int line,
int col)
Called when a close element (a close tag) is found. |
void |
handleComment(char[] buffer,
int offset,
int len,
int line,
int col)
Called when a comment is found. |
void |
handleDocType(String elementName,
String publicId,
String systemId,
String internalSubset,
int line,
int col)
Called when a DOCTYPE clause is found. |
void |
handleDocumentEnd(long endTimeNanos,
long totalTimeNanos,
int line,
int col,
MarkupParsingConfiguration markupParsingConfiguration)
Called when document parsing ends. |
void |
handleDocumentStart(long startTimeNanos,
int line,
int col,
MarkupParsingConfiguration markupParsingConfiguration)
Called when document parsing starts. |
void |
handleOpenElement(String elementName,
Map<String,String> attributes,
int line,
int col)
Called when an open element (an open tag) is found. |
void |
handleProcessingInstruction(String target,
String content,
int line,
int col)
Called when a Processing Instruction is found. |
void |
handleStandaloneElement(String elementName,
Map<String,String> attributes,
int line,
int col)
Called when a standalone element (a minimized tag) is found. |
void |
handleText(char[] buffer,
int offset,
int len,
int line,
int col)
Called when a text artifact is found. |
void |
handleUnmatchedClosedElement(String elementName,
int line,
int col)
Called when a close element (a close tag) appears without a corresponding open element. |
void |
handleXmlDeclaration(String version,
String encoding,
String standalone,
int line,
int col)
Called when an XML Declaration is found. |
| Methods inherited from class org.attoparser.markup.AbstractDetailedMarkupAttoHandler |
|---|
handleCloseElement, handleDocType, handleDocumentEnd, handleDocumentStart, handleOpenElement, handleStandaloneElement, handleXmlDeclaration |
| Methods inherited from class org.attoparser.markup.AbstractBasicMarkupAttoHandler |
|---|
handleStructure |
| Methods inherited from class org.attoparser.AbstractAttoHandler |
|---|
getEndTimeNanos, getStartTimeNanos, getTotalTimeNanos, handleDocumentEnd, handleDocumentStart |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextTracingStandardMarkupAttoHandler(Writer writer)
public TextTracingStandardMarkupAttoHandler(Writer writer,
MarkupParsingConfiguration markupParsingConfiguration)
| Method Detail |
|---|
public void handleDocumentStart(long startTimeNanos,
int line,
int col,
MarkupParsingConfiguration markupParsingConfiguration)
throws AttoParseException
AbstractDetailedMarkupAttoHandlerCalled when document parsing starts.
handleDocumentStart in class AbstractDetailedMarkupAttoHandlerstartTimeNanos - the starting time, in nanoseconds.markupParsingConfiguration - the document restrictions being applied.
AttoParseException
public void handleDocumentEnd(long endTimeNanos,
long totalTimeNanos,
int line,
int col,
MarkupParsingConfiguration markupParsingConfiguration)
throws AttoParseException
AbstractDetailedMarkupAttoHandlerCalled when document parsing ends.
handleDocumentEnd in class AbstractDetailedMarkupAttoHandlerendTimeNanos - the parsing end time, in nanoseconds.totalTimeNanos - the difference between parsing start and end times.markupParsingConfiguration - the document restrictions being applied.
AttoParseException
public void handleStandaloneElement(String elementName,
Map<String,String> attributes,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a standalone element (a minimized tag) is found.
Note that the element attributes map can be null if no attributes are present.
handleStandaloneElement in class AbstractStandardMarkupAttoHandlerelementName - the element name (e.g. "<img src="logo.png">" -> "img").attributes - the element attributes map, or null if no attributes are present.line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleOpenElement(String elementName,
Map<String,String> attributes,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when an open element (an open tag) is found.
Note that the element attributes map can be null if no attributes are present.
handleOpenElement in class AbstractStandardMarkupAttoHandlerelementName - the element name (e.g. "<div class="content">" -> "div").attributes - the element attributes map, or null if no attributes are present.line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleCloseElement(String elementName,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a close element (a close tag) is found.
handleCloseElement in class AbstractStandardMarkupAttoHandlerelementName - the element name (e.g. "</div>" -> "div").line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleAutoClosedElement(String elementName,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a close element (a close tag) is needed in order to correctly balance the markup. This is called autoclosing.
Implementors might choose to ignore these autoclosing events.
handleAutoClosedElement in class AbstractStandardMarkupAttoHandlerelementName - the element name (e.g. "</div>" -> "div").line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleUnmatchedClosedElement(String elementName,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a close element (a close tag) appears without a corresponding open element.
Implementors might choose to ignore these events.
handleUnmatchedClosedElement in class AbstractStandardMarkupAttoHandlerelementName - the element name (e.g. "</div>" -> "div").line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleDocType(String elementName,
String publicId,
String systemId,
String internalSubset,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a DOCTYPE clause is found.
handleDocType in class AbstractStandardMarkupAttoHandlerelementName - the root element name present in the DOCTYPE clause (e.g. "html").publicId - the public ID specified, if present (might be null).systemId - the system ID specified, if present (might be null).internalSubset - the internal subset specified, if present (might be null).line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleComment(char[] buffer,
int offset,
int len,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a comment is found.
This artifact is returned as a char[] instead of a String because its content can be large. In order to convert it into a String, just do new String(buffer, offset, len).
handleComment in class AbstractStandardMarkupAttoHandlerbuffer - the document buffer.offset - the offset of the artifact in the document buffer.len - the length (in chars) of the artifact.line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleCDATASection(char[] buffer,
int offset,
int len,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a CDATA section is found.
This artifact is returned as a char[] instead of a String because its content can be large. In order to convert it into a String, just do new String(buffer, offset, len).
handleCDATASection in class AbstractStandardMarkupAttoHandlerbuffer - the document buffer.offset - the offset of the artifact in the document buffer.len - the length (in chars) of the artifact.line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleText(char[] buffer,
int offset,
int len,
int line,
int col)
throws AttoParseException
IAttoHandlerCalled when a text artifact is found.
A sequence of chars is considered to be text when no structures of any kind are contained inside it. In markup parsers, for example, this means no tags (a.k.a. elements), DOCTYPE's, processing instructions, etc. are contained in the sequence.
Text sequences might include any number of new line and/or control characters.
Text artifacts are reported using the document buffer directly, and this buffer should not be considered to be immutable, so reported texts 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.
handleText in interface IAttoHandlerhandleText in class AbstractAttoHandlerbuffer - the document buffer (not copied)offset - the offset (position in buffer) where the text artifact starts.len - the length (in chars) of the text artifact, starting in offset.line - the line in the original document where this text artifact starts.col - the column in the original document where this text artifact starts.
AttoParseException
public void handleXmlDeclaration(String version,
String encoding,
String standalone,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when an XML Declaration is found.
handleXmlDeclaration in class AbstractStandardMarkupAttoHandlerversion - the version value specified (cannot be null).encoding - the encoding value specified (can be null).standalone - the standalone value specified (can be null).line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
public void handleProcessingInstruction(String target,
String content,
int line,
int col)
throws AttoParseException
AbstractStandardMarkupAttoHandlerCalled when a Processing Instruction is found.
handleProcessingInstruction in class AbstractStandardMarkupAttoHandlertarget - the target specified in the processing instruction.content - the content of the processing instruction, if specified (might be null).line - the line in the document where this elements appears.col - the column in the document where this element appears.
AttoParseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||