Package org.dom4j

Examples of org.dom4j.Document


  public static Map<String, PluginParameter> parseParameters(
      PluginEntity plugin) {
    Map<String, PluginParameter> result =
      new HashMap<String, PluginParameter>();
    Document dataDoc = null;
    try {
      dataDoc = DocumentHelper.parseText(plugin.getConfigData());
    }
    catch (DocumentException e) {
    }
    try {
      Document configDoc = DocumentHelper.parseText(
          plugin.getConfigStructure());
      for (Element element : (List<Element>)configDoc.getRootElement()
          .elements()) {
        PluginParameter param = new PluginParameter(element);
        try {
          param.setValue(dataDoc.getRootElement().elementText(
            param.getName()));
View Full Code Here


  }
 
  public Map<String, String> getValues() {
    Map<String, String> result = new HashMap<String, String>();
    try {
      Document doc = DocumentHelper.parseText(getData());
      for (Element e : (List<Element>)doc.getRootElement().elements()) {
        result.put(e.getName(), e.getText());
      }
    }
    catch (DocumentException e) {
      logger.error(e.getMessage());
View Full Code Here

    this.content = content;
  }

  public List<StructureFieldVO> getFields() {
    try {
      Document doc = DocumentHelper.parseText(getContent());
      List<StructureFieldVO> result = new ArrayList<StructureFieldVO>();
      for (Iterator<Element> i = doc.getRootElement().elementIterator();
          i.hasNext(); ) {
          Element element = i.next();
          if (element.getName().equals("field")) {
            result.add(new StructureFieldVO(
                element.elementText("title"),
View Full Code Here

   * @return document
   */
  public static Document loadIMSDocument(VFSLeaf documentF) {
    InputStream in = null;
    BufferedInputStream bis = null;
    Document doc = null;
    try {
      in = documentF.getInputStream();
      bis = new BufferedInputStream(in);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(bis, false);
View Full Code Here

   * @return document
   */
  public static Document loadIMSDocument(File documentF) {
    FileInputStream in = null;
    BufferedInputStream bis = null;
    Document doc = null;
    try {
      in = new FileInputStream(documentF);
      bis = new BufferedInputStream(in);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(bis, false);
View Full Code Here

    if (source == tableCtr) {
      TableEvent tEvent = (TableEvent)event;
      if (tEvent.getActionId().equals("sel")) {
        QTIResultSet resultSet = tableModel.getResultSet(tEvent.getRowId());
       
        Document doc = FilePersister.retreiveResultsReporting(identity, type, resultSet.getAssessmentID());
        if (doc == null) {
          getWindowControl().setInfo(getTranslator().translate("error.resreporting.na"));
          return;
        }
        StringBuilder resultsHTML = LocalizedXSLTransformer.getInstance(ureq.getLocale()).renderResults(doc);
View Full Code Here

  public static boolean validate(File unzippedDir) {
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedDir);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    //getDocument(..) ensures that InputStream is closed in every case.
    Document doc = QTIHelper.getDocument((LocalFileImpl) vfsQTI);
    //if doc is null an error loading the document occured
    if (doc == null) return false;
    List metas = doc.selectNodes("questestinterop/assessment/qtimetadata/qtimetadatafield");
    for (Iterator iter = metas.iterator(); iter.hasNext();) {
      Element el_metafield = (Element) iter.next();
      Element el_label = (Element) el_metafield.selectSingleNode("fieldlabel");
      String label = el_label.getText();
      if (label.equals(AssessmentInstance.QMD_LABEL_TYPE)) { // type meta
View Full Code Here

  /**
   * Constructor of the content packaging tree model
   * @param manifest the imsmanifest.xml file
   */
  CPManifestTreeModel(VFSLeaf manifest) {
    Document doc = loadDocument(manifest);
    // get all organization elements. need to set namespace
    rootElement = doc.getRootElement();
    String nsuri = rootElement.getNamespace().getURI();
    nsuris.put( "ns", nsuri);

    XPath meta = rootElement.createXPath("//ns:organization");
    meta.setNamespaceURIs(nsuris);
View Full Code Here

    return gtn;
  }
 
  private Document loadDocument(VFSLeaf documentF) {
    InputStream in = null;
    Document doc = null;
    try {
      in = documentF.getInputStream();
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(in, false);
      in.close();
View Full Code Here

          getWindowControl().setInfo(translator.translate("status.results.notsaved"));
        }

        if (!qtistatus.isSurvey()) { // for test and self-assessment, generate
                                      // detailed results
          Document docResReporting = iqm.getResultsReporting(ai, ureq);
          if (!iqsec.isPreview()) {
            FilePersister.createResultsReporting(docResReporting, ureq.getIdentity(), ai.getFormattedType(), ai.getAssessID());
            // Send score and passed to parent controller. Maybe it is necessary
            // to save some data there
            // Do this now and not later, maybe user will never click on
View Full Code Here

TOP

Related Classes of org.dom4j.Document

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.