org.attoparser.markup.IDetailedElementHandling Maven / Gradle / Ivy
Show all versions of attoparser Show documentation
/*
* =============================================================================
*
* Copyright (c) 2012, The ATTOPARSER team (http://www.attoparser.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
package org.attoparser.markup;
import org.attoparser.AttoParseException;
/**
*
* Handler feature interface to be implemented by {@link org.attoparser.IAttoHandler} implementations
* that offer detailed reporting of elements (markup tags).
*
*
* @author Daniel Fernández
*
* @since 1.0
*
*/
public interface IDetailedElementHandling extends IAttributeSequenceHandling {
/**
*
* 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.
*
*
* @param buffer the document buffer (not copied)
* @param nameOffset the offset (position in buffer) where the element name appears.
* @param nameLen the length (in chars) of the element name.
* @param line the line in the original document where this artifact starts.
* @param col the column in the original document where this artifact starts.
* @throws AttoParseException
*/
public void handleStandaloneElementStart(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws AttoParseException;
/**
*
* Called when the end of a standalone element (a minimized tag) is found
*
*
* @param line the line in the original document where the element ending structure appears.
* @param col the column in the original document where the element ending structure appears.
* @throws AttoParseException
*/
public void handleStandaloneElementEnd(
final int line, final int col)
throws AttoParseException;
/**
*
* 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.
*
*
* @param buffer the document buffer (not copied)
* @param nameOffset the offset (position in buffer) where the element name appears.
* @param nameLen the length (in chars) of the element name.
* @param line the line in the original document where this artifact starts.
* @param col the column in the original document where this artifact starts.
* @throws AttoParseException
*/
public void handleOpenElementStart(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws AttoParseException;
/**
*
* Called when the end of an open element (an open tag) is found.
*
*
* @param line the line in the original document where the element ending structure appears.
* @param col the column in the original document where the element ending structure appears.
* @throws AttoParseException
*/
public void handleOpenElementEnd(
final int line, final int col)
throws AttoParseException;
/**
*
* 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.
*
*
* @param buffer the document buffer (not copied)
* @param nameOffset the offset (position in buffer) where the element name appears.
* @param nameLen the length (in chars) of the element name.
* @param line the line in the original document where this artifact starts.
* @param col the column in the original document where this artifact starts.
* @throws AttoParseException
*/
public void handleCloseElementStart(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws AttoParseException;
/**
*
* Called when the end of a close element (a close tag) is found.
*
*
* @param line the line in the original document where the element ending structure appears.
* @param col the column in the original document where the element ending structure appears.
* @throws AttoParseException
*/
public void handleCloseElementEnd(
final int line, final int col)
throws AttoParseException;
/**
*
* 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.
*
*
* @param buffer the document buffer (not copied)
* @param nameOffset the offset (position in buffer) where the element name appears.
* @param nameLen the length (in chars) of the element name.
* @param line the line in the original document where this artifact starts.
* @param col the column in the original document where this artifact starts.
* @throws AttoParseException
*/
public void handleUnmatchedCloseElementStart(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws AttoParseException;
/**
*
* Called when the end of an unmatched close element (close tag) is found.
*
*
* @param line the line in the original document where the element ending structure appears.
* @param col the column in the original document where the element ending structure appears.
* @throws AttoParseException
*/
public void handleUnmatchedCloseElementEnd(
final int line, final int col)
throws AttoParseException;
/**
*
* 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.
*
*
* @param buffer the document buffer (not copied)
* @param nameOffset the offset (position in buffer) where the element name appears.
* @param nameLen the length (in chars) of the element name.
* @param line the line in the original document where this artifact starts.
* @param col the column in the original document where this artifact starts.
* @throws AttoParseException
*/
public void handleAutoCloseElementStart(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws AttoParseException;
/**
*
* Called for signaling the end of an auto-close element, created for
* balancing an unclosed tag.
*
*
* @param line the line in the original document where the element ending structure appears.
* @param col the column in the original document where the element ending structure appears.
* @throws AttoParseException
*/
public void handleAutoCloseElementEnd(
final int line, final int col)
throws AttoParseException;
}