Package org.dom4j

Examples of org.dom4j.Element.selectNodes()


   */
  public List getQTIItemObjectList() {
    Resolver resolver = new ImsRepositoryResolver(repositoryEntryKey);
    Document doc = resolver.getQTIDocument();
    Element root = doc.getRootElement();
    List items = root.selectNodes("//item");
   
    ArrayList itemList = new ArrayList();

    for (Iterator iter= items.iterator(); iter.hasNext();) {
      Element el_item= (Element) iter.next();
View Full Code Here


   
    ArrayList itemList = new ArrayList();

    for (Iterator iter= items.iterator(); iter.hasNext();) {
      Element el_item= (Element) iter.next();
      if (el_item.selectNodes(".//response_lid").size() > 0){
        itemList.add(new ItemWithResponseLid(el_item));
      }else if (el_item.selectNodes(".//response_str").size() > 0){
        itemList.add(new ItemWithResponseStr(el_item));
      }
    }
View Full Code Here

    for (Iterator iter= items.iterator(); iter.hasNext();) {
      Element el_item= (Element) iter.next();
      if (el_item.selectNodes(".//response_lid").size() > 0){
        itemList.add(new ItemWithResponseLid(el_item));
      }else if (el_item.selectNodes(".//response_str").size() > 0){
        itemList.add(new ItemWithResponseStr(el_item));
      }
    }
    return itemList;
  }
View Full Code Here

    int i = 1;
    for (Iterator itresponseLid = responseLids.iterator(); itresponseLid.hasNext();) { 
      Element el_responseLid = (Element) itresponseLid.next();
      isSingle = el_responseLid.attributeValue("rcardinality").equals("Single");
     
      List labels = el_responseLid.selectNodes(".//response_label");
      Element decvar = (Element) el_item.selectSingleNode(".//outcomes/decvar");
      if (decvar != null){
        this.itemMinValue = decvar.attributeValue("minvalue");
        this.itemMaxValue = decvar.attributeValue("maxvalue");
        this.itemCutValue = decvar.attributeValue("cutvalue");
View Full Code Here

      for (Iterator itlabel = labels.iterator(); itlabel.hasNext();) {
        Element el_label = (Element) itlabel.next();
        String sIdent = el_label.attributeValue("ident");
        responseLabelIdents.add(sIdent);
       
        List materials = el_label.selectNodes(".//mattext");
        StringBuilder mat = new StringBuilder();
        for (Iterator itmaterial = materials.iterator(); itmaterial.hasNext();) {
          Element el_material = (Element) itmaterial.next();
          mat.append(el_material.getText());
        }
View Full Code Here

        // get type of multiple choice
        if (instance.getType() == TYPE_MC) {
          // if does not contain any ANDs, assume only one combination
          // of answers is possible (which sets points by a setvar action="Set")
          if (resprocessingXML.selectNodes(".//setvar[@action='Add']").size() == 0) {
            instance.setSingleCorrect(true);
            Collection values = points.values();
            if (values.size() > 0) instance.setSingleCorrectScore(((Float) (values.iterator().next())).floatValue());
          } else {
            instance.setSingleCorrect(false);
View Full Code Here

          } catch (NumberFormatException e) {
            // set maxValue 0
          }
          for (int i = 0; i < choices.size(); i++) {
            ChoiceResponse choice = (ChoiceResponse) choices.get(i);
            if (resprocessingXML.selectNodes(
                "./respcondition[@title='Mastery']/conditionvar/varequal[text()='" + choice.getIdent() + ":correct']").size() > 0) {
              choice.setCorrect(true);
              choice.setPoints(maxValue / 4);
            } else {
              choice.setCorrect(false);
View Full Code Here

        }
      } 
 
      // if does not contain any ANDs, assume only one combination
      // of answers is possible (which sets points by a setvar action="Set")
      if (resprocessingXML.selectNodes(".//setvar[@action='Add']").size() == 0) {
        instance.setSingleCorrect(true);
        Collection values = points.values();
        if (values.size() > 0)
          instance.setSingleCorrectScore(((Float)(values.iterator().next())).floatValue());
      } else {
View Full Code Here

    // clone the whole item
    Element el_rendchoice = (Element) choice.selectSingleNode(shuffleItem);
    //  <!ELEMENT render_choice ((material | material_ref | response_label |
    // flow_label)* ,response_na?)>
    // <!ATTLIST response_label rshuffle (Yes | No ) 'Yes' .....
    List el_labels = el_rendchoice.selectNodes(".//response_label[@rshuffle=\"Yes\"]");
    int shusize = el_labels.size();

    // set up a list of children with their parents and the position of the
    // child (in case several children have the same parent
    List respList = new ArrayList(shusize);
View Full Code Here

      scoremodel = el_outpro.attributeValue("scoremodel");
      // may be null -> then assume SumOfScores

      // set the cutvalue if given (only variable score)
      cutvalue = QTIHelper.getFloatAttribute(el_outpro, "outcomes/decvar[@varname='SCORE']", "cutvalue");
      List el_oft = el_outpro.selectNodes("outcomes_feedback_test");
      if (el_oft.size() != 0) {
        feedbacktesting = true;
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.