use of uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException.InterpretationFailureReason in project openolat by klemens.
the class BadRessourceHelper method extractMessage.
public static void extractMessage(BadResourceException e, StringBuilder out) {
if (e instanceof QtiXmlInterpretationException) {
QtiXmlInterpretationException qe = (QtiXmlInterpretationException) e;
if (qe.getQtiModelBuildingErrors() != null) {
for (QtiModelBuildingError error : qe.getQtiModelBuildingErrors()) {
String localName = error.getElementLocalName();
String msg = error.getException().getMessage();
if (error.getElementLocation() != null) {
int lineNumber = error.getElementLocation().getLineNumber();
out.append(lineNumber + " :: " + localName + " :: " + msg + "\n");
} else {
out.append(localName + " :: " + msg + "\n");
}
}
}
if (qe.getInterpretationFailureReason() != null) {
InterpretationFailureReason reason = qe.getInterpretationFailureReason();
out.append("Failure: " + reason + "\n");
}
if (qe.getXmlParseResult() != null) {
XmlParseResult result = qe.getXmlParseResult();
if (result.getWarnings() != null) {
for (SAXParseException saxex : result.getWarnings()) {
int lineNumber = saxex.getLineNumber();
int columnNumber = saxex.getColumnNumber();
String msg = saxex.getMessage();
out.append("Warnings: " + lineNumber + ":" + columnNumber + " :: " + msg + "\n");
}
}
if (result.getErrors() != null) {
for (SAXParseException saxex : result.getErrors()) {
int lineNumber = saxex.getLineNumber();
int columnNumber = saxex.getColumnNumber();
String msg = saxex.getMessage();
out.append("Error: " + lineNumber + ":" + columnNumber + " :: " + msg + "\n");
}
}
if (result.getFatalErrors() != null) {
for (SAXParseException saxex : result.getFatalErrors()) {
int lineNumber = saxex.getLineNumber();
int columnNumber = saxex.getColumnNumber();
String msg = saxex.getMessage();
out.append("Fatal: " + lineNumber + ":" + columnNumber + " :: " + msg + "\n");
}
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException.InterpretationFailureReason in project OpenOLAT by OpenOLAT.
the class BadRessourceHelper method extractMessage.
public static void extractMessage(BadResourceException e, StringBuilder out) {
if (e instanceof QtiXmlInterpretationException) {
QtiXmlInterpretationException qe = (QtiXmlInterpretationException) e;
if (qe.getQtiModelBuildingErrors() != null) {
for (QtiModelBuildingError error : qe.getQtiModelBuildingErrors()) {
String localName = error.getElementLocalName();
String msg = error.getException().getMessage();
if (error.getElementLocation() != null) {
int lineNumber = error.getElementLocation().getLineNumber();
out.append(lineNumber + " :: " + localName + " :: " + msg + "\n");
} else {
out.append(localName + " :: " + msg + "\n");
}
}
}
if (qe.getInterpretationFailureReason() != null) {
InterpretationFailureReason reason = qe.getInterpretationFailureReason();
out.append("Failure: " + reason + "\n");
}
if (qe.getXmlParseResult() != null) {
XmlParseResult result = qe.getXmlParseResult();
if (result.getWarnings() != null) {
for (SAXParseException saxex : result.getWarnings()) {
int lineNumber = saxex.getLineNumber();
int columnNumber = saxex.getColumnNumber();
String msg = saxex.getMessage();
out.append("Warnings: " + lineNumber + ":" + columnNumber + " :: " + msg + "\n");
}
}
if (result.getErrors() != null) {
for (SAXParseException saxex : result.getErrors()) {
int lineNumber = saxex.getLineNumber();
int columnNumber = saxex.getColumnNumber();
String msg = saxex.getMessage();
out.append("Error: " + lineNumber + ":" + columnNumber + " :: " + msg + "\n");
}
}
if (result.getFatalErrors() != null) {
for (SAXParseException saxex : result.getFatalErrors()) {
int lineNumber = saxex.getLineNumber();
int columnNumber = saxex.getColumnNumber();
String msg = saxex.getMessage();
out.append("Fatal: " + lineNumber + ":" + columnNumber + " :: " + msg + "\n");
}
}
}
}
}
Aggregations