Examples of selectNodes()


Examples of org.dom4j.Element.selectNodes()

   
    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

Examples of org.dom4j.Element.selectNodes()

    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

Examples of org.dom4j.Element.selectNodes()

    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

Examples of org.dom4j.Element.selectNodes()

      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

Examples of org.dom4j.Element.selectNodes()

        // 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

Examples of org.dom4j.Element.selectNodes()

          } 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

Examples of org.dom4j.Element.selectNodes()

        }
      } 
 
      // 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

Examples of org.dom4j.Node.selectNodes()

                Node copyNode = (Node)copyNodes.get(i);
                String path = XmlUtils.getAttributeValue(copyNode, "path");
                if (!filesToDeploy.containsKey(path)) {
                    filesToDeploy.put(path, new ArrayList<String>());
                }
                final List targetPaths = copyNode.selectNodes("./target");
                if (null != targetPaths) {
                    for (int j = 0; j < targetPaths.size(); j++) {
                        Node targetPath = (Node)targetPaths.get(j);
                        filesToDeploy.get(path).add(targetPath.getText());
                    }
View Full Code Here

Examples of org.dom4j.XPath.selectNodes()

    resourcesXPath.setNamespaceURIs(nsuris);
    Element elResources = (Element)resourcesXPath.selectSingleNode(rootElement);
    if (elResources == null) throw new AddingResourceException("resource.no.resource"); // no <resources> element.
    XPath itemsXPath = rootElement.createXPath("//ns:item");
    itemsXPath.setNamespaceURIs(nsuris);
    List items = itemsXPath.selectNodes(rootElement);
    if (items.size() == 0) throw new AddingResourceException("scorm.no.item"); // no <item> element.
   
    // check for scorm 2004 simple sequencing stuff which we do not yet support
    if (seqencingUri != null) {
        XPath seqencingXPath = rootElement.createXPath("//ns:imsss");
View Full Code Here

Examples of org.dom4j.xpath.DefaultXPath.selectNodes()

    if (!loaded()){
      throw new Exception ("XML Document not loaded.");
    }
    DefaultXPath dxp = new DefaultXPath(xPathStmt);
    dxp.setNamespaceContext(namespaceContext);
    List nodes = dxp.selectNodes(m_oRootElement);
    return nodes;
  }
 
  /**
   * Perform an xPath Query and return the first node that matches.
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.