1 10 11 package org.enhydra.jawe.xml; 12 13 import java.util.*; 14 15 import org.xml.sax.*; 16 17 20 public class ParsingErrors implements ErrorHandler { 21 22 public ParsingErrors () { 23 super(); 24 } 25 26 Set errorMessages = new HashSet(); 27 28 public void warning(SAXParseException ex) { 29 store(ex, "[Warning]"); 30 } 31 32 public void error(SAXParseException ex) { 33 store(ex, "[Error]"); 34 } 35 36 public void fatalError(SAXParseException ex) throws SAXException { 37 store(ex, "[Fatal Error]"); 38 } 39 40 public Set getErrorMessages() { 41 return errorMessages; 42 } 43 44 public void clearErrors() { 45 errorMessages.clear(); 46 } 47 48 void store(SAXParseException ex, String type) { 49 String errorString= type+" at line number "+ex.getLineNumber() 51 +": "+ex.getMessage()+"\n"; 52 errorMessages.add(errorString); 53 } 54 } 55 | Popular Tags |