001 package net.sf.logdistiller.xml;
002
003 /*
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 import org.xml.sax.ErrorHandler;
018 import org.xml.sax.SAXParseException;
019
020 public class SAXErrorHandler
021 implements ErrorHandler
022 {
023 public void error( SAXParseException spe )
024 {
025 System.err.println( "Parsing error on line " + spe.getLineNumber() + " and column " + spe.getColumnNumber()
026 + ": " + spe.getMessage() );
027 Exception e = spe.getException();
028 if ( e != null )
029 {
030 e.printStackTrace();
031 }
032 }
033
034 public void fatalError( SAXParseException spe )
035 {
036 error( spe );
037 }
038
039 public void warning( SAXParseException spe )
040 {
041 System.err.println( "Parsing warning on line " + spe.getLineNumber() + " and column " + spe.getColumnNumber()
042 + ": " + spe.getMessage() );
043 Exception e = spe.getException();
044 if ( e != null )
045 {
046 e.printStackTrace();
047 }
048 }
049 }