Package org.dom4j

Examples of org.dom4j.Document.selectSingleNode()


    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("-");
View Full Code Here


    VFSItem vfsQTI = vfsUnzippedRoot.resolve(ident + ".xml");
    //getDocument(..) ensures that InputStream is closed in every case.
    Document theDoc = QTIHelper.getDocument((LocalFileImpl) vfsQTI);
    //if doc is null an error loading the document occured (IOException, qti.xml does not exist)
    if (theDoc == null) return null;
    Element objectBank = (Element) theDoc.selectSingleNode("questestinterop/objectbank");
    return objectBank;
  }

  /**
   * (non-Javadoc)
 
View Full Code Here

  public int getCurrentStepNumber(String filePath) throws Exception{
   
      SAXReader reader = new SAXReader();
        Document document = reader.read(filePath+InstallationDocumentHandler.installFileName);
       
        Node node = document.selectSingleNode( "//install/step/stepnumber" );
       
        return Integer.valueOf(node.getText()).intValue();
       
  }
 
View Full Code Here

      configurationFilePath = configurationFile.getAbsolutePath();
      Document document = XmlUtility.parseXmlFile(configurationFile);
      if (document != null) {
        // setting up strategy
        XmlConfigStrategy strategy = null;
        Node node = document.selectSingleNode(VERSION_XPATH);
        if (node != null && "2".equals(node.getText().trim())) {
          strategy = new DefaultXmlStrategy(document);
        } else {
          strategy = new BackwardCompatibilityXmlStrategy(document);
        }
View Full Code Here

     
      if(xmlContent != null){
        try{
          SAXReader reader = new SAXReader();
        Document document = reader.read(new StringReader(xmlContent));
        Node node = document.selectSingleNode("/pdfsam/latestVersion/@value");
        if(node != null){
          retVal = node.getText().trim();
          retVal = (retVal.length()>0)? retVal: null;
        }
      }catch(Exception e){
View Full Code Here

      try {
        synchronized(Environment.class){
          SAXReader reader = new SAXReader();
          Document document = reader.read(inputFile);
          for (AbstractPlugablePanel plugablePanel: plugins.values()) {
            Node node = document.selectSingleNode("/pdfsam_saved_jobs/plugin[@class=\""
                + plugablePanel.getClass().getName() + "\"]");
            if(node == null){
              //backwards compatibility
              node = document.selectSingleNode("/pdfsam_saved_jobs/plugin[@class=\""
                  + plugablePanel.getClass().getName().replaceAll("^org.pdfsam", "it.pdfsam") + "\"]");
View Full Code Here

          for (AbstractPlugablePanel plugablePanel: plugins.values()) {
            Node node = document.selectSingleNode("/pdfsam_saved_jobs/plugin[@class=\""
                + plugablePanel.getClass().getName() + "\"]");
            if(node == null){
              //backwards compatibility
              node = document.selectSingleNode("/pdfsam_saved_jobs/plugin[@class=\""
                  + plugablePanel.getClass().getName().replaceAll("^org.pdfsam", "it.pdfsam") + "\"]");
            }
            if(node != null){
              plugablePanel.resetPanel();
              plugablePanel.loadJobNode(node);
View Full Code Here

              plugablePanel.resetPanel();
              plugablePanel.loadJobNode(node);
            }
          }
          //set the selected plugin
          Node node = document.selectSingleNode("/pdfsam_saved_jobs/@selection");
          if(node!=null){
            treePanel.setSelectedPlugin(node.getText());
          }
          LOG.info(GettextResource.gettext(i18nMessages, "Environment loaded."));
        }
View Full Code Here

        PostMethod page = login(cubit,httpClient,user,password);

        for (int i=0; true; i++) {
            Document rsp = parsePage(page);

            Element key = (Element)rsp.selectSingleNode("//*[@id='api_key_shown']");
            if (key!=nullreturn key.getTextTrim();

            if (i!=0)
                throw new IOException("Server responded with 200 but we still can't find the API key");

View Full Code Here

        // Get creator
        ParentChildCreatorInterface creator = null;
        String absoluteDoctypesPath = sitemapParentPath + doctypesPath;
        Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                "doctypes.xconf");
        Attribute creator_src = (Attribute) doctypesDoc.selectSingleNode("/doctypes/doc[@type='" +
                doctype + "']/creator/@src");

        if (creator_src != null) {
            getLogger().info(".act(): Creator found for \"" + doctype + "\": " +
                creator_src.getName() + " " + creator_src.getPath() + " " + creator_src.getValue());
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.