Package org.dom4j

Examples of org.dom4j.Document.selectNodes()


            SAXReader saxReader = new SAXReader(false);
            saxReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
                    false);
            Document doc = saxReader.read(webXML);
            // Find all <servelt-mapping> entries to discover name to URL mapping.
            List names = doc.selectNodes("//servlet-mapping");
            for (int i = 0; i < names.size(); i++) {
                Element nameElement = (Element)names.get(i);
                String url = nameElement.element("url-pattern").getTextTrim();
                // Destroy the servlet than remove from servlets map.
                HttpServlet servlet = servlets.get(pluginName + url);
View Full Code Here


            SAXReader saxReader = new SAXReader(false);
            saxReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
                    false);
            Document doc = saxReader.read(webXML);
            // Find all <servlet> entries to discover name to class mapping.
            List classes = doc.selectNodes("//servlet");
            Map<String, Class> classMap = new HashMap<String, Class>();
            for (int i = 0; i < classes.size(); i++) {
                Element servletElement = (Element)classes.get(i);
                String name = servletElement.element("servlet-name").getTextTrim();
                String className = servletElement.element("servlet-class").getTextTrim();
View Full Code Here

                String name = servletElement.element("servlet-name").getTextTrim();
                String className = servletElement.element("servlet-class").getTextTrim();
                classMap.put(name, finder.loadClass(className, component));
            }
            // Find all <servelt-mapping> entries to discover name to URL mapping.
            List names = doc.selectNodes("//servlet-mapping");
            for (int i = 0; i < names.size(); i++) {
                Element nameElement = (Element)names.get(i);
                String name = nameElement.element("servlet-name").getTextTrim();
                String url = nameElement.element("url-pattern").getTextTrim();
                // Register the servlet for the URL.
View Full Code Here

              throw new SlideShowException(SlideShowException.ERR_DEFAULT_TRANSITION_ALREADY_SET);
            }else{
              transitions.setDefaultTransition(new Transition(Transition.EVERY_PAGE, new Integer(defTransDur.getText().trim()).intValue(), defType.getText().trim(), new Integer(defDur.getText().trim()).intValue()));
            }
          }
          List transitionsList = document.selectNodes("/transitions/transition");
          for (int i = 0; transitionsList != null && i < transitionsList.size(); i++) {
            Node transitionNode = (Node) transitionsList.get(i);
            Node type = transitionNode.selectSingleNode("@type");
            Node transDuration = transitionNode.selectSingleNode("@tduration");
            Node duration = transitionNode.selectSingleNode("@duration");
View Full Code Here

    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

    // 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;
    // check if this is marked as test
    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

        if (!(entry.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF) || entry.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS))) return false;
      }
    }

    // check if at least one section with one item
    List sectionItems = doc.selectNodes("questestinterop/assessment/section/item");
    if (sectionItems.size() == 0) return false;
   
   
    for (Iterator iter = sectionItems.iterator(); iter.hasNext();) {
      Element it = (Element) iter.next();
View Full Code Here

        htmlTA.setValue(el_mat.getTextTrim());
    } else htmlTA.setValue("-");
    addFormElement("qti.objectives", htmlTA);
   
    // extract num of questions
    List items = doc.selectNodes("//item");
    if (items.size() > 0)
      addFormElement("qti.questions", new StaticTextElement("qti.questions", "" + items.size()));
    else addFormElement("qti.questions", new StaticTextElement("qti.questions", "-"));
   
    // extract time limit
View Full Code Here

    @SuppressWarnings("unchecked")
  private Vector<StringItem> loadLanguages(){
      Vector<StringItem> langs = new Vector<StringItem>(10,5);
      try{
      Document document = XmlUtility.parseXmlFile(this.getClass().getResource("/org/pdfsam/i18n/languages.xml"));
      List<Node> nodeList = document.selectNodes("/languages/language");
      for (int i = 0; nodeList != null && i < nodeList.size(); i++){
        Node langNode  =((Node) nodeList.get(i));
        if (langNode != null){
          langs.add(new StringItem(langNode.selectSingleNode("@value").getText(), langNode.selectSingleNode("@description").getText()));
        }
View Full Code Here

    @SuppressWarnings("rawtypes")
    private static void loadChangesetForProject(final String projectPath,
            final List<String> changedFiles) throws IOException, DocumentException, ApplicationException {
       
        Document projectChangeset = SvnUtils.getChangeset(projectPath);
        List changedFilesNodes = projectChangeset.selectNodes("/status/target/entry/@path");
        if (null != changedFilesNodes) {
            for (int i = 0; i < changedFilesNodes.size(); i++) {
                Node changedFilesNode = (Node)changedFilesNodes.get(i);
                final String changedFileName = FilenameUtils.concat(projectPath, changedFilesNode.getText());
                final File changedFile = new File(changedFileName);
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.