286N/A/*
286N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/Apackage javax.xml.transform;
286N/A
286N/A/**
286N/A * <p>To provide customized error handling, implement this interface and
286N/A * use the <code>setErrorListener</code> method to register an instance of the
286N/A * implmentation with the {@link javax.xml.transform.Transformer}. The
286N/A * <code>Transformer</code> then reports all errors and warnings through this
286N/A * interface.</p>
286N/A *
286N/A * <p>If an application does <em>not</em> register its own custom
286N/A * <code>ErrorListener</code>, the default <code>ErrorListener</code>
286N/A * is used which reports all warnings and errors to <code>System.err</code>
286N/A * and does not throw any <code>Exception</code>s.
286N/A * Applications are <em>strongly</em> encouraged to register and use
286N/A * <code>ErrorListener</code>s that insure proper behavior for warnings and
286N/A * errors.</p>
286N/A *
286N/A * <p>For transformation errors, a <code>Transformer</code> must use this
286N/A * interface instead of throwing an <code>Exception</code>: it is up to the
286N/A * application to decide whether to throw an <code>Exception</code> for
286N/A * different types of errors and warnings. Note however that the
286N/A * <code>Transformer</code> is not required to continue with the transformation
286N/A * after a call to {@link #fatalError(TransformerException exception)}.</p>
286N/A *
286N/A * <p><code>Transformer</code>s may use this mechanism to report XML parsing
286N/A * errors as well as transformation errors.</p>
286N/A */
286N/Apublic interface ErrorListener {
286N/A
286N/A /**
286N/A * Receive notification of a warning.
286N/A *
286N/A * <p>{@link javax.xml.transform.Transformer} can use this method to report
286N/A * conditions that are not errors or fatal errors. The default behaviour
286N/A * is to take no action.</p>
286N/A *
286N/A * <p>After invoking this method, the Transformer must continue with
286N/A * the transformation. It should still be possible for the
286N/A * application to process the document through to the end.</p>
286N/A *
286N/A * @param exception The warning information encapsulated in a
286N/A * transformer exception.
286N/A *
286N/A * @throws javax.xml.transform.TransformerException if the application
286N/A * chooses to discontinue the transformation.
286N/A *
286N/A * @see javax.xml.transform.TransformerException
286N/A */
286N/A public abstract void warning(TransformerException exception)
286N/A throws TransformerException;
286N/A
286N/A /**
286N/A * Receive notification of a recoverable error.
286N/A *
286N/A * <p>The transformer must continue to try and provide normal transformation
286N/A * after invoking this method. It should still be possible for the
286N/A * application to process the document through to the end if no other errors
286N/A * are encountered.</p>
286N/A *
286N/A * @param exception The error information encapsulated in a
286N/A * transformer exception.
286N/A *
286N/A * @throws javax.xml.transform.TransformerException if the application
286N/A * chooses to discontinue the transformation.
286N/A *
286N/A * @see javax.xml.transform.TransformerException
286N/A */
286N/A public abstract void error(TransformerException exception)
286N/A throws TransformerException;
286N/A
286N/A /**
286N/A * <p>Receive notification of a non-recoverable error.</p>
286N/A *
286N/A * <p>The processor may choose to continue, but will not normally
286N/A * proceed to a successful completion.</p>
286N/A *
286N/A * <p>The method should throw an exception if it is unable to
286N/A * process the error, or if it wishes execution to terminate
286N/A * immediately. The processor will not necessarily honor this
286N/A * request.</p>
286N/A *
286N/A * @param exception The error information encapsulated in a
286N/A * <code>TransformerException</code>.
286N/A *
286N/A * @throws javax.xml.transform.TransformerException if the application
286N/A * chooses to discontinue the transformation.
286N/A *
286N/A * @see javax.xml.transform.TransformerException
286N/A */
286N/A public abstract void fatalError(TransformerException exception)
286N/A throws TransformerException;
286N/A}