All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.attoparser.IElementHandler Maven / Gradle / Ivy

There is a newer version: 2.0.7.RELEASE
Show newest version
/*
 * =============================================================================
 * 
 *   Copyright (c) 2012-2014, 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;

/**
 * 

* Interface to be implemented by all handlers capable of receiving events about elements. *

*

* Events in this interface are a part of the {@link IMarkupHandler} interface, the main handling interface in * AttoParser. *

* * @author Daniel Fernández * @since 2.0.0 * @see org.attoparser.IMarkupHandler * */ public interface IElementHandler extends IAttributeSequenceHandler { /** *

* Called when a standalone element (an element with no closing 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 minimized whether the element has been found minimized (<element/>)in code or not. * @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 ParseException if any exceptions occur during handling. */ public void handleStandaloneElementStart( final char[] buffer, final int nameOffset, final int nameLen, final boolean minimized, final int line, final int col) throws ParseException; /** *

* Called when the end of a standalone element (an element with no closing tag) is found *

*

* 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 minimized whether the element has been found minimized (<element/>)in code or not. * @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 ParseException if any exceptions occur during handling. */ public void handleStandaloneElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final boolean minimized, final int line, final int col) throws ParseException; /** *

* 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 ParseException if any exceptions occur during handling. */ public void handleOpenElementStart( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

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

*

* 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 the element ending structure appears. * @param col the column in the original document where the element ending structure appears. * @throws ParseException if any exceptions occur during handling. */ public void handleOpenElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

* Called for signaling the start of an auto-open element (a synthetic open tag), * created for adapting parsed markup to a specification such as, for example, HTML5. 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 ParseException if any exceptions occur during handling. */ public void handleAutoOpenElementStart( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

* Called for signaling the end of an auto-open element (a synthetic open tag), * created for adapting parsed markup to a specification such as, for example, HTML5. 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 the element ending structure appears. * @param col the column in the original document where the element ending structure appears. * @throws ParseException if any exceptions occur during handling. */ public void handleAutoOpenElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

* 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 ParseException if any exceptions occur during handling. */ public void handleCloseElementStart( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

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

*

* 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 the element ending structure appears. * @param col the column in the original document where the element ending structure appears. * @throws ParseException if any exceptions occur during handling. */ public void handleCloseElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

* 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 ParseException if any exceptions occur during handling. */ public void handleAutoCloseElementStart( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

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

*

* 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 the element ending structure appears. * @param col the column in the original document where the element ending structure appears. * @throws ParseException if any exceptions occur during handling. */ public void handleAutoCloseElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

* 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 ParseException if any exceptions occur during handling. */ public void handleUnmatchedCloseElementStart( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; /** *

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

*

* 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 the element ending structure appears. * @param col the column in the original document where the element ending structure appears. * @throws ParseException if any exceptions occur during handling. */ public void handleUnmatchedCloseElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy