// extract title
Element el_assess = (Element)doc.selectSingleNode("questestinterop/assessment");
String title = el_assess.attributeValue("title");
if (title != null) addFormElement("qti.title", new StaticTextElement("qti.title", title));
else addFormElement("qti.title", new StaticTextElement("qti.title", "-"));
// extract objectives
HTMLTextAreaElement htmlTA = new HTMLTextAreaElement("qti.objectives", 10, 60);
htmlTA.setReadOnly(true);
Element el_objectives = (Element)doc.selectSingleNode("//questestinterop/assessment/objectives");
if (el_objectives != null) {
Element el_mat = (Element)el_objectives.selectSingleNode("material/mattext");
if (el_mat != null)
htmlTA.setValue(el_mat.getTextTrim());
} else htmlTA.setValue("-");
addFormElement("qti.objectives", htmlTA);
// extract num of questions
List items = doc.selectNodes("//item");
if (items.size() > 0)
addFormElement("qti.questions", new StaticTextElement("qti.questions", "" + items.size()));
else addFormElement("qti.questions", new StaticTextElement("qti.questions", "-"));
// extract time limit
Element el_duration = (Element)el_assess.selectSingleNode("duration");
if (el_duration != null) {
long dur = QTIHelper.parseISODuration(el_duration.getTextTrim());
long min = dur / 1024 / 60;
long sec = (dur - (min * 60 * 1024)) / 1024;
addFormElement("qti.timelimit", new StaticTextElement("qti.timelimit", min + "' " + sec + "''"));
} else addFormElement("qti.timelimit", new StaticTextElement("qti.timelimit", "-"));
}