org.attoparser.IXMLDeclarationHandler Maven / Gradle / Ivy
Show all versions of attoparser Show documentation
/*
* =============================================================================
*
* 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 XML Declarations.
*
*
* 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 IXMLDeclarationHandler {
/**
*
* 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.
*
*
* @param buffer the document buffer (not copied)
* @param keywordOffset offset for the keyword partition.
* @param keywordLen length of the keyword partition.
* @param keywordLine the line in the original document where the keyword partition starts.
* @param keywordCol the column in the original document where the keyword partition starts.
* @param versionOffset offset for the version partition.
* @param versionLen length of the version partition.
* @param versionLine the line in the original document where the version partition starts.
* @param versionCol the column in the original document where the version partition starts.
* @param encodingOffset offset for the encoding partition.
* @param encodingLen length of the encoding partition.
* @param encodingLine the line in the original document where the encoding partition starts.
* @param encodingCol the column in the original document where the encoding partition starts.
* @param standaloneOffset offset for the standalone partition.
* @param standaloneLen length of the standalone partition.
* @param standaloneLine the line in the original document where the standalone partition starts.
* @param standaloneCol the column in the original document where the standalone partition starts.
* @param outerOffset offset for the outer partition.
* @param outerLen length of the outer partition.
* @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 handleXmlDeclaration(
final char[] buffer,
final int keywordOffset, final int keywordLen,
final int keywordLine, final int keywordCol,
final int versionOffset, final int versionLen,
final int versionLine, final int versionCol,
final int encodingOffset, final int encodingLen,
final int encodingLine, final int encodingCol,
final int standaloneOffset, final int standaloneLen,
final int standaloneLine, final int standaloneCol,
final int outerOffset, final int outerLen,
final int line, final int col)
throws ParseException;
}