1 56 57 package com.sun.org.apache.xerces.internal.jaxp; 58 59 import java.util.Locale ; 60 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; 61 import org.xml.sax.SAXException ; 62 import org.xml.sax.SAXParseException ; 63 import org.xml.sax.helpers.DefaultHandler ; 64 65 68 69 class DefaultValidationErrorHandler extends DefaultHandler { 70 static private int ERROR_COUNT_LIMIT = 10; 71 private int errorCount = 0; 72 73 74 public void error(SAXParseException e) throws SAXException { 75 if (errorCount >= ERROR_COUNT_LIMIT) { 76 return; 78 } else if (errorCount == 0) { 79 81 System.err.println(SAXMessageFormatter.formatMessage(Locale.getDefault(), "errorHandlerNotSet", new Object []{String.valueOf(ERROR_COUNT_LIMIT)})); 82 83 } 84 85 String systemId = e.getSystemId(); 86 if (systemId == null) { 87 systemId = "null"; 88 } 89 90 System.err.println(SAXMessageFormatter.formatMessage(Locale.getDefault(),"errorHandlerDebugMsg", new Object [] { 91 systemId,String.valueOf(e.getLineNumber()), e.getMessage()})); 92 errorCount++; 93 } 94 } 95 | Popular Tags |