Search in sources :

Example 6 with SaxFiringOptions

use of uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions 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;
    }
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) FileOutputStream(java.io.FileOutputStream) XsltSerializationOptions(uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions) SaxFiringOptions(uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions) QtiXmlInterpretationException(uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) XmlResourceNotFoundException(uk.ac.ed.ph.jqtiplus.xmlutils.XmlResourceNotFoundException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Aggregations

StreamResult (javax.xml.transform.stream.StreamResult)6 SaxFiringOptions (uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions)6 XsltSerializationOptions (uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions)6 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 TransformerException (javax.xml.transform.TransformerException)2 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)2 QtiXmlInterpretationException (uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException)2 XmlResourceNotFoundException (uk.ac.ed.ph.jqtiplus.xmlutils.XmlResourceNotFoundException)2