Search in sources :

Example 1 with QTI21ExplorerHandler

use of org.olat.ims.qti21.model.xml.QTI21ExplorerHandler in project OpenOLAT by OpenOLAT.

the class CopyAndConvertVisitor method scanFile.

private QTI21Infos scanFile(Path inputFile) {
    QTI21ExplorerHandler infosHandler = new QTI21ExplorerHandler();
    try (InputStream in = Files.newInputStream(inputFile)) {
        SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
        saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", infosHandler);
        saxParser.parse(in, infosHandler);
    } catch (Exception e1) {
        log.error("", e1);
    }
    return infosHandler.getInfos();
}
Also used : QTI21ExplorerHandler(org.olat.ims.qti21.model.xml.QTI21ExplorerHandler) InputStream(java.io.InputStream) SAXParser(javax.xml.parsers.SAXParser) URISyntaxException(java.net.URISyntaxException) QtiXmlInterpretationException(uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) IOException(java.io.IOException)

Example 2 with QTI21ExplorerHandler

use of org.olat.ims.qti21.model.xml.QTI21ExplorerHandler in project OpenOLAT by OpenOLAT.

the class QTI21IMSManifestExplorerVisitor method scanFile.

private QTI21ExplorerHandler scanFile(Path inputFile) {
    QTI21ExplorerHandler infosHandler = new QTI21ExplorerHandler();
    try (InputStream in = Files.newInputStream(inputFile)) {
        SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
        saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", infosHandler);
        saxParser.parse(in, infosHandler);
    } catch (Exception e1) {
        log.error("", e1);
    }
    return infosHandler;
}
Also used : QTI21ExplorerHandler(org.olat.ims.qti21.model.xml.QTI21ExplorerHandler) InputStream(java.io.InputStream) SAXParser(javax.xml.parsers.SAXParser) IOException(java.io.IOException)

Example 3 with QTI21ExplorerHandler

use of org.olat.ims.qti21.model.xml.QTI21ExplorerHandler in project openolat by klemens.

the class CopyAndConvertVisitor method scanFile.

private QTI21Infos scanFile(Path inputFile) {
    QTI21ExplorerHandler infosHandler = new QTI21ExplorerHandler();
    try (InputStream in = Files.newInputStream(inputFile)) {
        SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
        saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", infosHandler);
        saxParser.parse(in, infosHandler);
    } catch (Exception e1) {
        log.error("", e1);
    }
    return infosHandler.getInfos();
}
Also used : QTI21ExplorerHandler(org.olat.ims.qti21.model.xml.QTI21ExplorerHandler) InputStream(java.io.InputStream) SAXParser(javax.xml.parsers.SAXParser) URISyntaxException(java.net.URISyntaxException) QtiXmlInterpretationException(uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) IOException(java.io.IOException)

Example 4 with QTI21ExplorerHandler

use of org.olat.ims.qti21.model.xml.QTI21ExplorerHandler in project openolat by klemens.

the class QTI21IMSManifestExplorerVisitor method scanFile.

private QTI21ExplorerHandler scanFile(Path inputFile) {
    QTI21ExplorerHandler infosHandler = new QTI21ExplorerHandler();
    try (InputStream in = Files.newInputStream(inputFile)) {
        SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
        saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", infosHandler);
        saxParser.parse(in, infosHandler);
    } catch (Exception e1) {
        log.error("", e1);
    }
    return infosHandler;
}
Also used : QTI21ExplorerHandler(org.olat.ims.qti21.model.xml.QTI21ExplorerHandler) InputStream(java.io.InputStream) SAXParser(javax.xml.parsers.SAXParser) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)4 InputStream (java.io.InputStream)4 SAXParser (javax.xml.parsers.SAXParser)4 QTI21ExplorerHandler (org.olat.ims.qti21.model.xml.QTI21ExplorerHandler)4 URISyntaxException (java.net.URISyntaxException)2 BadResourceException (uk.ac.ed.ph.jqtiplus.provision.BadResourceException)2 QtiXmlInterpretationException (uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException)2