Search in sources :

Example 1 with ItemWithResponseLid

use of org.olat.ims.qti.export.helper.ItemWithResponseLid in project OpenOLAT by OpenOLAT.

the class QTIStatisticsManagerLargeTest method getItemObjectList.

@SuppressWarnings("rawtypes")
private void getItemObjectList() {
    InputStream in = QTIStatisticsManagerLargeTest.class.getResourceAsStream("qti.xml");
    XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
    Document doc = xmlParser.parse(in, false);
    Element root = doc.getRootElement();
    List items = root.selectNodes("//item");
    itemObjects = new ArrayList<QTIItemObject>();
    for (Iterator iter = items.iterator(); iter.hasNext(); ) {
        Element el_item = (Element) iter.next();
        if (el_item.selectNodes(".//response_lid").size() > 0) {
            itemObjects.add(new ItemWithResponseLid(el_item));
        } else if (el_item.selectNodes(".//response_str").size() > 0) {
            itemObjects.add(new ItemWithResponseStr(el_item));
        }
    }
}
Also used : ItemWithResponseLid(org.olat.ims.qti.export.helper.ItemWithResponseLid) QTIItemObject(org.olat.ims.qti.export.helper.QTIItemObject) InputStream(java.io.InputStream) Element(org.dom4j.Element) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) ItemWithResponseStr(org.olat.ims.qti.export.helper.ItemWithResponseStr) XMLParser(org.olat.core.util.xml.XMLParser) Document(org.dom4j.Document) IMSEntityResolver(org.olat.ims.resources.IMSEntityResolver)

Example 2 with ItemWithResponseLid

use of org.olat.ims.qti.export.helper.ItemWithResponseLid in project openolat by klemens.

the class QTIStatisticsManagerLargeTest method getItemObjectList.

@SuppressWarnings("rawtypes")
private void getItemObjectList() {
    InputStream in = QTIStatisticsManagerLargeTest.class.getResourceAsStream("qti.xml");
    XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
    Document doc = xmlParser.parse(in, false);
    Element root = doc.getRootElement();
    List items = root.selectNodes("//item");
    itemObjects = new ArrayList<QTIItemObject>();
    for (Iterator iter = items.iterator(); iter.hasNext(); ) {
        Element el_item = (Element) iter.next();
        if (el_item.selectNodes(".//response_lid").size() > 0) {
            itemObjects.add(new ItemWithResponseLid(el_item));
        } else if (el_item.selectNodes(".//response_str").size() > 0) {
            itemObjects.add(new ItemWithResponseStr(el_item));
        }
    }
}
Also used : ItemWithResponseLid(org.olat.ims.qti.export.helper.ItemWithResponseLid) QTIItemObject(org.olat.ims.qti.export.helper.QTIItemObject) InputStream(java.io.InputStream) Element(org.dom4j.Element) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) ItemWithResponseStr(org.olat.ims.qti.export.helper.ItemWithResponseStr) XMLParser(org.olat.core.util.xml.XMLParser) Document(org.dom4j.Document) IMSEntityResolver(org.olat.ims.resources.IMSEntityResolver)

Aggregations

InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Document (org.dom4j.Document)2 Element (org.dom4j.Element)2 XMLParser (org.olat.core.util.xml.XMLParser)2 ItemWithResponseLid (org.olat.ims.qti.export.helper.ItemWithResponseLid)2 ItemWithResponseStr (org.olat.ims.qti.export.helper.ItemWithResponseStr)2 QTIItemObject (org.olat.ims.qti.export.helper.QTIItemObject)2 IMSEntityResolver (org.olat.ims.resources.IMSEntityResolver)2