1 16 package org.apache.cocoon.woody.validation; 17 18 import org.xml.sax.ContentHandler ; 19 import org.xml.sax.SAXException ; 20 import org.apache.cocoon.woody.util.I18nMessage; 21 import org.apache.cocoon.woody.util.StringMessage; 22 import org.apache.excalibur.xml.sax.XMLizable; 23 24 31 public class ValidationError { 32 33 34 private XMLizable saxFragment; 35 36 39 public ValidationError(String errorMessage, boolean i18n) { 40 if (i18n) { 41 saxFragment = new I18nMessage(errorMessage); 42 } else { 43 saxFragment = new StringMessage(errorMessage); 44 } 45 } 46 47 50 public ValidationError(String errorMessageKey) { 51 this.saxFragment = new I18nMessage(errorMessageKey); 52 } 53 54 57 public ValidationError(String errorMessageKey, String [] parameters) { 58 this.saxFragment = new I18nMessage(errorMessageKey, parameters); 59 } 60 61 64 public ValidationError(String errorMessageKey, String [] parameters, boolean[] keys) { 65 this.saxFragment = new I18nMessage(errorMessageKey, parameters, keys); 66 } 67 68 74 public ValidationError(XMLizable errorMessage) { 75 this.saxFragment = errorMessage; 76 } 77 78 82 public void generateSaxFragment(ContentHandler contentHandler) throws SAXException { 83 if (saxFragment != null) { 84 saxFragment.toSAX(contentHandler); 85 } 86 } 87 } 88 | Popular Tags |