Package org.dom4j

Examples of org.dom4j.Element.selectSingleNode()


        // Gets the user's ID from Clearspace
        try {
            String path = ClearspaceUserProvider.USER_URL_PREFIX + "usersByID/" + id;
            Element element = executeRequest(org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.GET, path);

            String username = WSUtils.getElementText(element.selectSingleNode("return"), "username"); // TODO: is this right?

            // Escape the username so that it can be used as a JID.
            username = JID.escapeNode(username);

            usernameCache.put(id, username);
View Full Code Here


            // Encode potentially non-ASCII characters
            groupname = URLUTF8Encoder.encode(groupname);
            String path = ClearspaceGroupProvider.URL_PREFIX + "groups/" + groupname;
            Element element = executeRequest(org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.GET, path);

            Long id = Long.valueOf(WSUtils.getElementText(element.selectSingleNode("return"), "ID"));
            // Saves it into the cache
            groupIDCache.put(groupname, id);

            return id;
        } catch (GroupNotFoundException gnfe) {
View Full Code Here

    }

    public void parseProjectFile(File file) throws Exception {
        projectDocument = reader.read(file);
        Element projectElement = projectDocument.getRootElement();
        node = new DefaultMutableTreeNode(projectElement.selectSingleNode("./name"));
    }

    public TreeNode getNodes() {
        return this.node;
    }
View Full Code Here

        {
          final Element updateElement = (Element) updateElements.get(i);
          final String version = updateElement.attributeValue("version");//NON-NLS
          final String type = updateElement.attributeValue("type");//NON-NLS
          //final String os = updateElement.attributeValue("os");
          final String downloadUrl = updateElement.selectSingleNode("downloadurl").getText();//NON-NLS
          final UpdateInfo info = new UpdateInfo(version, type, downloadUrl);
          updates.add(info);
        }

        if (updates.isEmpty())
View Full Code Here

       
        // Turn stored queries into CDATA-Sections
        List queries = doc.selectNodes("/wga/contentdbs/contentdb/storedqueries/storedquery/query");
        for (Iterator iter = queries.iterator(); iter.hasNext();) {
            Element query = (Element) iter.next();
            Node text = query.selectSingleNode("text()");
            if (text != null && text instanceof Text) {
                query.addCDATA(text.getText());
                query.remove(text);
            }
        }
View Full Code Here

     * @param newDBKey The new database key for the copy
     * @return new created contentDBElement
     */
    public static Element copyContentDB(Element contentDBElement, String newDBKey) {
        Element copy = (Element) contentDBElement.clone();
        copy.selectSingleNode("dbkey").setText(newDBKey.toLowerCase());     
        Element contentdbs = contentDBElement.getParent();
        contentdbs.add(copy);
        return copy;
    }
   
View Full Code Here

            List<Contact> result = new ArrayList<Contact>();

            for (Iterator<Element> it = document.getRootElement().elementIterator("contact"); it.hasNext();) {
                Element contactElement = it.next();

                Node nomElement = contactElement.selectSingleNode("nom");
                Node prenomElement = contactElement.selectSingleNode("prenom");
                List<Node> emailsElement = contactElement.selectNodes("email");
                Node descriptionElement = contactElement.selectSingleNode("description");

                Contact contact = new Contact();
View Full Code Here

            for (Iterator<Element> it = document.getRootElement().elementIterator("contact"); it.hasNext();) {
                Element contactElement = it.next();

                Node nomElement = contactElement.selectSingleNode("nom");
                Node prenomElement = contactElement.selectSingleNode("prenom");
                List<Node> emailsElement = contactElement.selectNodes("email");
                Node descriptionElement = contactElement.selectSingleNode("description");

                Contact contact = new Contact();
                contact.setNom(nomElement.getText());
View Full Code Here

                Element contactElement = it.next();

                Node nomElement = contactElement.selectSingleNode("nom");
                Node prenomElement = contactElement.selectSingleNode("prenom");
                List<Node> emailsElement = contactElement.selectNodes("email");
                Node descriptionElement = contactElement.selectSingleNode("description");

                Contact contact = new Contact();
                contact.setNom(nomElement.getText());
                contact.setPrenom(prenomElement.getText());
                if(descriptionElement != null)
View Full Code Here

        Element server = (Element) document
                .selectSingleNode("/properties/server");
        assertTrue("Found a valid server", server != null);

        Element root = document.getRootElement();
        server = (Element) root.selectSingleNode("/properties/server");
        assertTrue("Found a valid server", server != null);

        // try finding it via a relative path
        server = (Element) document.selectSingleNode("properties/server");
        assertTrue("Found a valid server", server != null);
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.