Source Code Cross Referenced for ErrorHandler.java in  » 6.0-JDK-Core » xml » org » xml » sax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » org.xml.sax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        // SAX error handler.
027        // http://www.saxproject.org
028        // No warranty; no copyright -- use this as you will.
029        // $Id: ErrorHandler.java,v 1.2 2004/11/03 22:44:52 jsuttor Exp $
030        package org.xml.sax;
031
032        /**
033         * Basic interface for SAX error handlers.
034         *
035         * <blockquote>
036         * <em>This module, both source code and documentation, is in the
037         * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
038         * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
039         * for further information.
040         * </blockquote>
041         *
042         * <p>If a SAX application needs to implement customized error
043         * handling, it must implement this interface and then register an
044         * instance with the XML reader using the
045         * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
046         * method.  The parser will then report all errors and warnings
047         * through this interface.</p>
048         *
049         * <p><strong>WARNING:</strong> If an application does <em>not</em>
050         * register an ErrorHandler, XML parsing errors will go unreported,
051         * except that <em>SAXParseException</em>s will be thrown for fatal errors.
052         * In order to detect validity errors, an ErrorHandler that does something
053         * with {@link #error error()} calls must be registered.</p>
054         *
055         * <p>For XML processing errors, a SAX driver must use this interface 
056         * in preference to throwing an exception: it is up to the application 
057         * to decide whether to throw an exception for different types of 
058         * errors and warnings.  Note, however, that there is no requirement that 
059         * the parser continue to report additional errors after a call to 
060         * {@link #fatalError fatalError}.  In other words, a SAX driver class 
061         * may throw an exception after reporting any fatalError.
062         * Also parsers may throw appropriate exceptions for non-XML errors.
063         * For example, {@link XMLReader#parse XMLReader.parse()} would throw
064         * an IOException for errors accessing entities or the document.</p>
065         *
066         * @since SAX 1.0
067         * @author David Megginson
068         * @version 2.0.1+ (sax2r3pre1)
069         * @see org.xml.sax.XMLReader#setErrorHandler
070         * @see org.xml.sax.SAXParseException 
071         */
072        public interface ErrorHandler {
073
074            /**
075             * Receive notification of a warning.
076             *
077             * <p>SAX parsers will use this method to report conditions that
078             * are not errors or fatal errors as defined by the XML
079             * recommendation.  The default behaviour is to take no
080             * action.</p>
081             *
082             * <p>The SAX parser must continue to provide normal parsing events
083             * after invoking this method: it should still be possible for the
084             * application to process the document through to the end.</p>
085             *
086             * <p>Filters may use this method to report other, non-XML warnings
087             * as well.</p>
088             *
089             * @param exception The warning information encapsulated in a
090             *                  SAX parse exception.
091             * @exception org.xml.sax.SAXException Any SAX exception, possibly
092             *            wrapping another exception.
093             * @see org.xml.sax.SAXParseException 
094             */
095            public abstract void warning(SAXParseException exception)
096                    throws SAXException;
097
098            /**
099             * Receive notification of a recoverable error.
100             *
101             * <p>This corresponds to the definition of "error" in section 1.2
102             * of the W3C XML 1.0 Recommendation.  For example, a validating
103             * parser would use this callback to report the violation of a
104             * validity constraint.  The default behaviour is to take no
105             * action.</p>
106             *
107             * <p>The SAX parser must continue to provide normal parsing
108             * events after invoking this method: it should still be possible
109             * for the application to process the document through to the end.
110             * If the application cannot do so, then the parser should report
111             * a fatal error even if the XML recommendation does not require
112             * it to do so.</p>
113             *
114             * <p>Filters may use this method to report other, non-XML errors
115             * as well.</p>
116             *
117             * @param exception The error information encapsulated in a
118             *                  SAX parse exception.
119             * @exception org.xml.sax.SAXException Any SAX exception, possibly
120             *            wrapping another exception.
121             * @see org.xml.sax.SAXParseException 
122             */
123            public abstract void error(SAXParseException exception)
124                    throws SAXException;
125
126            /**
127             * Receive notification of a non-recoverable error.
128             *
129             * <p><strong>There is an apparent contradiction between the
130             * documentation for this method and the documentation for {@link
131             * org.xml.sax.ContentHandler#endDocument}.  Until this ambiguity
132             * is resolved in a future major release, clients should make no
133             * assumptions about whether endDocument() will or will not be
134             * invoked when the parser has reported a fatalError() or thrown
135             * an exception.</strong></p>
136             *
137             * <p>This corresponds to the definition of "fatal error" in
138             * section 1.2 of the W3C XML 1.0 Recommendation.  For example, a
139             * parser would use this callback to report the violation of a
140             * well-formedness constraint.</p>
141             *
142             * <p>The application must assume that the document is unusable
143             * after the parser has invoked this method, and should continue
144             * (if at all) only for the sake of collecting additional error
145             * messages: in fact, SAX parsers are free to stop reporting any
146             * other events once this method has been invoked.</p>
147             *
148             * @param exception The error information encapsulated in a
149             *                  SAX parse exception.  
150             * @exception org.xml.sax.SAXException Any SAX exception, possibly
151             *            wrapping another exception.
152             * @see org.xml.sax.SAXParseException
153             */
154            public abstract void fatalError(SAXParseException exception)
155                    throws SAXException;
156
157        }
158
159        // end of ErrorHandler.java
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.