use of uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions in project openolat by klemens.
the class QTI21ServiceImpl method storeStateDocument.
private void storeStateDocument(Document stateXml, File sessionFile) {
XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
xsltSerializationOptions.setIndenting(true);
xsltSerializationOptions.setIncludingXMLDeclaration(false);
Transformer serializer = XsltStylesheetManager.createSerializer(xsltSerializationOptions);
try (OutputStream resultStream = new FileOutputStream(sessionFile)) {
serializer.transform(new DOMSource(stateXml), new StreamResult(resultStream));
} catch (TransformerException | IOException e) {
throw new OLATRuntimeException("Unexpected Exception serializing state DOM", e);
}
}
use of uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method storeStateDocument.
private void storeStateDocument(Document stateXml, File sessionFile) {
XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
xsltSerializationOptions.setIndenting(true);
xsltSerializationOptions.setIncludingXMLDeclaration(false);
Transformer serializer = XsltStylesheetManager.createSerializer(xsltSerializationOptions);
try (OutputStream resultStream = new FileOutputStream(sessionFile)) {
serializer.transform(new DOMSource(stateXml), new StreamResult(resultStream));
} catch (TransformerException | IOException e) {
throw new OLATRuntimeException("Unexpected Exception serializing state DOM", e);
}
}
use of uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions in project openolat by klemens.
the class QTI21ServiceImpl method persistAssessmentObject.
@Override
public boolean persistAssessmentObject(File resourceFile, AssessmentObject assessmentObject) {
try (FileOutputStream out = new FileOutputStream(resourceFile)) {
final XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
xsltSerializationOptions.setIndenting(false);
qtiSerializer().serializeJqtiObject(assessmentObject, new StreamResult(out), new SaxFiringOptions(), xsltSerializationOptions);
assessmentTestsCache.remove(resourceFile);
assessmentItemsCache.remove(resourceFile);
return true;
} catch (Exception e) {
log.error("", e);
return false;
}
}
Aggregations