Search in sources :

Example 1 with SaxFiringOptions

use of uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions in project OpenOLAT by OpenOLAT.

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)

Example 2 with SaxFiringOptions

use of uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions in project OpenOLAT by OpenOLAT.

the class AssessmentHtmlBuilder method serializeJqtiObject.

private void serializeJqtiObject(QtiNode node, StringOutput sb) {
    final XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
    xsltSerializationOptions.setIndenting(false);
    qtiSerializer.serializeJqtiObject(node, new StreamResult(sb), new SaxFiringOptions(), xsltSerializationOptions);
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) XsltSerializationOptions(uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions) SaxFiringOptions(uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions)

Example 3 with SaxFiringOptions

use of uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions in project OpenOLAT by OpenOLAT.

the class AssessmentItemBuilder method serializeJqtiObject.

protected final void serializeJqtiObject(QtiNode block, StringOutput sb) {
    final XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
    xsltSerializationOptions.setIndenting(false);
    qtiSerializer.serializeJqtiObject(block, new StreamResult(sb), new SaxFiringOptions(), xsltSerializationOptions);
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) XsltSerializationOptions(uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions) SaxFiringOptions(uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions)

Example 4 with SaxFiringOptions

use of uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions in project openolat by klemens.

the class AssessmentItemBuilder method serializeJqtiObject.

protected final void serializeJqtiObject(QtiNode block, StringOutput sb) {
    final XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
    xsltSerializationOptions.setIndenting(false);
    qtiSerializer.serializeJqtiObject(block, new StreamResult(sb), new SaxFiringOptions(), xsltSerializationOptions);
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) XsltSerializationOptions(uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions) SaxFiringOptions(uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions)

Example 5 with SaxFiringOptions

use of uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions in project openolat by klemens.

the class AssessmentHtmlBuilder method serializeJqtiObject.

private void serializeJqtiObject(QtiNode node, StringOutput sb) {
    final XsltSerializationOptions xsltSerializationOptions = new XsltSerializationOptions();
    xsltSerializationOptions.setIndenting(false);
    qtiSerializer.serializeJqtiObject(node, new StreamResult(sb), new SaxFiringOptions(), xsltSerializationOptions);
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) XsltSerializationOptions(uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions) SaxFiringOptions(uk.ac.ed.ph.jqtiplus.serialization.SaxFiringOptions)

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