1 21 22 package nu.xom; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 import org.xml.sax.SAXParseException ; 28 29 40 public class ValidityException extends ParsingException { 41 42 private List saxExceptions = new ArrayList (); 43 private transient Document document; 44 45 46 55 public ValidityException(String message, Throwable cause) { 56 super(message, cause); 57 } 58 59 60 72 public ValidityException( 73 String message, 74 int lineNumber, 75 int columnNumber) { 76 super(message, lineNumber, columnNumber); 77 } 78 79 80 94 public ValidityException( 95 String message, 96 int lineNumber, 97 int columnNumber, 98 Throwable cause) { 99 super(message, lineNumber, columnNumber, cause); 100 } 101 102 103 117 public ValidityException(String message, String uri, 118 int lineNumber, int columnNumber) { 119 super(message, uri, lineNumber, columnNumber); 120 } 121 122 123 138 public ValidityException( 139 String message, 140 String uri, 141 int lineNumber, 142 int columnNumber, 143 Throwable cause) { 144 super(message, uri, lineNumber, columnNumber, cause); 145 } 146 147 148 156 public ValidityException(String message) { 157 super(message); 158 } 159 160 161 171 public Document getDocument() { 172 return document; 173 } 174 175 176 void setDocument(Document doc) { 177 this.document = doc; 178 } 179 180 181 void addError(SAXParseException ex) { 182 saxExceptions.add(ex); 183 } 184 185 186 195 public int getErrorCount() { 196 return saxExceptions.size(); 197 } 198 199 200 217 public String getValidityError(int n) { 218 Exception ex = (Exception ) saxExceptions.get(n); 219 return ex.getMessage(); 220 } 221 222 223 241 public int getLineNumber(int n) { 242 SAXParseException ex = (SAXParseException ) saxExceptions.get(n); 243 return ex.getLineNumber(); 244 } 245 246 247 266 public int getColumnNumber(int n) { 267 SAXParseException ex = (SAXParseException ) saxExceptions.get(n); 268 return ex.getColumnNumber(); 269 } 270 271 272 } 273 | Popular Tags |