Package org.dom4j

Examples of org.dom4j.Attribute


    return null;
  }

  public boolean isAttributeNamespaceDeclaration(int index) {
    if (element != null) {
      Attribute attribute = element.attribute(index);

      if (attribute != null) {
        return "xmlns".equals(attribute.getNamespacePrefix());
      }
    }

    return false;
  }
View Full Code Here


    List decvars = element.selectNodes("*/decvar");
    if (decvars.size()== 0) return outcomesProcessing;

    Element decvar = (Element) decvars.get(0);
    for (Iterator iter = decvar.attributeIterator(); iter.hasNext();) {
      Attribute attr = (Attribute) iter.next();
      outcomesProcessing.setField(attr.getName(), attr.getValue());
    }
    return outcomesProcessing;
  }
View Full Code Here

    }
    // Extract min, max and cut value
    Float minValue = null, maxValue = null, cutValue = null;
    Element decvar = (Element) doc.selectSingleNode("questestinterop/assessment/outcomes_processing/outcomes/decvar");
    if (decvar != null) {
      Attribute minval = decvar.attribute("minvalue");
      if (minval != null) {
        String mv = minval.getValue();
        try {
          minValue = new Float(Float.parseFloat(mv));
        } catch (NumberFormatException e1) {
          // if not correct in qti file -> ignore
        }
      }
      Attribute maxval = decvar.attribute("maxvalue");
      if (maxval != null) {
        String mv = maxval.getValue();
        try {
          maxValue = new Float(Float.parseFloat(mv));
        } catch (NumberFormatException e1) {
          // if not correct in qti file -> ignore
        }
      }
      Attribute cutval = decvar.attribute("cutvalue");
      if (cutval != null) {
        String cv = cutval.getValue();
        try {
          cutValue = new Float(Float.parseFloat(cv));
        } catch (NumberFormatException e1) {
          // if not correct in qti file -> ignore
        }
View Full Code Here

    List materials = element.elements();
    if (materials.size() == 0) return null;

    Material material = new Material();
    // ATTRIBUTES
    Attribute label = element.attribute("label");
    if (label != null)
      material.setLable(label.getValue());

    // ELEMENTS
    for (Iterator i = materials.iterator(); i.hasNext();) {
      QTIObject obj = (QTIObject)parserManager.parse((Element)i.next());   
      if (obj != null)
View Full Code Here

    //assert element.getName().equalsIgnoreCase("assessment");
    Assessment assessment = new Assessment();
   
    // attributes
   
    Attribute attr = element.attribute("ident");
    if(attr!=null) assessment.setIdent(attr.getValue());
    attr = element.attribute("title");
    if(attr!=null) assessment.setTitle(attr.getValue());
   
    // elements

    // DURATION
    QTIObject duration =
View Full Code Here

    List materialsXML = element.selectNodes(".//material");
    if (materialsXML.size() == 0) return null;

    Feedback feedback = new Feedback();
    // attributes
    Attribute tmp = element.attribute("ident");
    if(tmp!=null) feedback.setIdent(tmp.getValue());
    tmp = element.attribute("title");
    if(tmp!=null) feedback.setTitle(tmp.getValue());
    tmp = element.attribute("view");
    if(tmp!=null) feedback.setView(tmp.getValue());
   
    // get type
    if (element.element("solution") != null) return null;
    else if (element.element("hint") != null) return null;
   
View Full Code Here

   * @see org.olat.ims.qti.editor.beecom.parser.IParser#parse(org.dom4j.Element)
   */
  public Object parse(Element element) {
    //assert element.getName().equalsIgnoreCase("item");
    Item item = new Item();
    Attribute tmp = element.attribute("ident");
    if (tmp != null)
      item.setIdent(tmp.getValue());
    else
      item.setIdent("" + CodeHelper.getRAMUniqueID());
   
    tmp = element.attribute("title");
    if (tmp != null)
      item.setTitle(tmp.getValue());
   
    tmp = element.attribute("label");
    if (tmp != null)
      item.setLabel(tmp.getValue());
   
    tmp = element.attribute("maxattempts");
    if (tmp != null) {
      try {
        item.setMaxattempts(Integer.parseInt(tmp.getValue()));
      } catch (NumberFormatException nfe) {
        item.setMaxattempts(0);
      }
    }

View Full Code Here

      XPath resourceXPath = rootElement.createXPath("//ns:resource[@identifier='" + identifierref + "']");
      resourceXPath.setNamespaceURIs(nsuris);
      Element elResource = (Element)resourceXPath.selectSingleNode(elResources);
      if (elResource == null) throw new AddingResourceException("resource.no.matching.resource");
      //check for scorm attribute
      Attribute scormAttr = elResource.attribute("scormtype");
      //some packages have attribute written like "scormType"
      Attribute scormAttrUpper = elResource.attribute("scormType");
      if (scormAttr == null && scormAttrUpper == null) throw new AddingResourceException("scorm.no.attribute.scormtype");
      String attr = "";
      if (scormAttr != null) attr = scormAttr.getStringValue();
      if (scormAttrUpper != null) attr = scormAttrUpper.getStringValue();
      if (attr == null) throw new AddingResourceException("scorm.no.attribute.value");
      if (elResource.attributeValue("href") != null && (attr.equalsIgnoreCase("sco") || attr.equalsIgnoreCase("asset"))) return true; // success.
    }
    throw new AddingResourceException("resource.general.error");
  }
View Full Code Here

              itemObj.put("text",subItem.getText());

              LinkedHashMap<String,String> attributes = new LinkedHashMap<String,String>();
             
              for (Iterator attr = subItem.attributeIterator(); attr.hasNext(); ) {
                Attribute at = (Attribute) attr.next();
                attributes.put(at.getName(),at.getText());             
              }
              itemObj.put("attributes",attributes);
             
              //log.error(subItem.getName()+ ": " +subItem.getText());
              items.put(subItem.getName(), itemObj);
View Full Code Here

    if (root == null) {
      // file was empty;
      return new ArrayList<TextMarker>();
    }
    // Do version check. Not needed now, for future lazy migration code...
    Attribute versionAttribute = root.attribute(XML_VERSION_ATTRIBUTE);
    int version = (versionAttribute == null ? 1 : Integer.parseInt(versionAttribute.getStringValue()));
    if (version != VERSION) {
      // complain about version conflict or solve it
      throw new OLATRuntimeException("Could not load glossary entries due to version conflict. Loaded version was::" + version, null);
    }
    // parse text marker objects and put them into a list
View Full Code Here

TOP

Related Classes of org.dom4j.Attribute

Copyright © 2018 www.massapicom. 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.