use of com.thaiopensource.relaxng.exceptions.AbstractValidationException in project validator by validator.
the class MessageEmitterAdapter method elaboration.
private void elaboration(Exception e) throws SAXException {
if (!(e instanceof AbstractValidationException || e instanceof VnuBadAttrValueException || e instanceof VnuBadElementNameException || e instanceof DatatypeMismatchException)) {
return;
}
if (e instanceof ImpossibleAttributeIgnoredException) {
ImpossibleAttributeIgnoredException ex = (ImpossibleAttributeIgnoredException) e;
Name elt = ex.getCurrentElement();
elaborateElementSpecificAttributes(elt, ex.getAttributeName());
} else if (e instanceof OnlyTextNotAllowedException) {
OnlyTextNotAllowedException ex = (OnlyTextNotAllowedException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof OutOfContextElementException) {
OutOfContextElementException ex = (OutOfContextElementException) e;
Name parent = ex.getParent();
Name child = ex.getCurrentElement();
elaborateContentModelandContext(parent, child);
} else if (e instanceof RequiredAttributesMissingException) {
RequiredAttributesMissingException ex = (RequiredAttributesMissingException) e;
Name elt = ex.getCurrentElement();
elaborateElementSpecificAttributes(elt);
} else if (e instanceof RequiredAttributesMissingOneOfException) {
RequiredAttributesMissingOneOfException ex = (RequiredAttributesMissingOneOfException) e;
Name elt = ex.getCurrentElement();
elaborateElementSpecificAttributes(elt);
} else if (e instanceof RequiredElementsMissingException) {
RequiredElementsMissingException ex = (RequiredElementsMissingException) e;
Name elt = ex.getParent();
elaborateContentModel(elt);
} else if (e instanceof RequiredElementsMissingOneOfException) {
RequiredElementsMissingOneOfException ex = (RequiredElementsMissingOneOfException) e;
Name elt = ex.getParent();
elaborateContentModel(elt);
} else if (e instanceof StringNotAllowedException) {
StringNotAllowedException ex = (StringNotAllowedException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof TextNotAllowedException) {
TextNotAllowedException ex = (TextNotAllowedException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof UnfinishedElementException) {
UnfinishedElementException ex = (UnfinishedElementException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof UnfinishedElementOneOfException) {
UnfinishedElementOneOfException ex = (UnfinishedElementOneOfException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof UnknownElementException) {
UnknownElementException ex = (UnknownElementException) e;
Name elt = ex.getParent();
elaborateContentModel(elt);
} else if (e instanceof BadAttributeValueException) {
BadAttributeValueException ex = (BadAttributeValueException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof VnuBadAttrValueException) {
VnuBadAttrValueException ex = (VnuBadAttrValueException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof VnuBadElementNameException) {
VnuBadElementNameException ex = (VnuBadElementNameException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof DatatypeMismatchException) {
DatatypeMismatchException ex = (DatatypeMismatchException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof StringNotAllowedException) {
StringNotAllowedException ex = (StringNotAllowedException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
}
}
use of com.thaiopensource.relaxng.exceptions.AbstractValidationException in project validator by validator.
the class MessageEmitterAdapter method messageText.
/**
* @param message
* @throws SAXException
*/
private void messageText(Exception message) throws SAXException {
if (message instanceof AbstractValidationException) {
AbstractValidationException ave = (AbstractValidationException) message;
rngMessageText(ave);
} else if (message instanceof VnuBadAttrValueException) {
VnuBadAttrValueException e = (VnuBadAttrValueException) message;
vnuBadAttrValueMessageText(e);
} else if (message instanceof VnuBadElementNameException) {
VnuBadElementNameException e = (VnuBadElementNameException) message;
vnuElementNameMessageText(e);
} else {
String msg = message.getMessage();
if (msg != null) {
MessageTextHandler messageTextHandler = emitter.startText();
if (messageTextHandler != null) {
emitStringWithQurlyQuotes(messageTextHandler, msg);
}
emitter.endText();
}
}
}
Aggregations