Package org.dom4j

Examples of org.dom4j.Document.selectNodes()


            Document dom = new SAXReader().read(new StringReader(sw.toString()));

            // apply exclusions
            if (excludes!=null) {
                for (String exclude : excludes) {
                    List<org.dom4j.Node> list = (List<org.dom4j.Node>)dom.selectNodes(exclude);
                    for (org.dom4j.Node n : list) {
                        Element parent = n.getParent();
                        if(parent!=null)
                            parent.remove(n);
                    }
View Full Code Here


            }
           
            if(xpath==null) {
              result = dom;
            } else {
                List list = dom.selectNodes(xpath);
                if (wrapper!=null) {
                    Element root = DocumentFactory.getInstance().createElement(wrapper);
                    for (Object o : list) {
                        if (o instanceof String) {
                            root.addText(o.toString());
View Full Code Here

        // parse the JNLP page into DOM to list up the jars.
        XmlPage jnlp = (XmlPage) wc.goTo("computer/test/slave-agent.jnlp","application/x-java-jnlp-file");
        URL baseUrl = jnlp.getWebResponse().getUrl();
        Document dom = new DOMReader().read(jnlp.getXmlDocument());
        for( Element jar : (List<Element>)dom.selectNodes("//jar") ) {
            URL url = new URL(baseUrl,jar.attributeValue("href"));
            System.out.println(url);
           
            // now make sure that these URLs are unprotected
            Page jarResource = jnlpAgent.getPage(url);
View Full Code Here

                return;
            }

            List xpathResults = new ArrayList();

            xpathResults.addAll(doc.selectNodes("//a/@href"));
            xpathResults.addAll(doc.selectNodes("//img/@src"));
            //<link rel="stylesheet" href="...">
            xpathResults.addAll(doc.selectNodes("//link/@href"));
            //<script src="http://ar.atwola.com/file/adsWrapper.js">
            xpathResults.addAll(doc.selectNodes("//script/@src"));
View Full Code Here

            }

            List xpathResults = new ArrayList();

            xpathResults.addAll(doc.selectNodes("//a/@href"));
            xpathResults.addAll(doc.selectNodes("//img/@src"));
            //<link rel="stylesheet" href="...">
            xpathResults.addAll(doc.selectNodes("//link/@href"));
            //<script src="http://ar.atwola.com/file/adsWrapper.js">
            xpathResults.addAll(doc.selectNodes("//script/@src"));
View Full Code Here

            List xpathResults = new ArrayList();

            xpathResults.addAll(doc.selectNodes("//a/@href"));
            xpathResults.addAll(doc.selectNodes("//img/@src"));
            //<link rel="stylesheet" href="...">
            xpathResults.addAll(doc.selectNodes("//link/@href"));
            //<script src="http://ar.atwola.com/file/adsWrapper.js">
            xpathResults.addAll(doc.selectNodes("//script/@src"));

            Map uniqueLinks = new HashMap();
            Iterator linkIter = xpathResults.iterator();
View Full Code Here

            xpathResults.addAll(doc.selectNodes("//a/@href"));
            xpathResults.addAll(doc.selectNodes("//img/@src"));
            //<link rel="stylesheet" href="...">
            xpathResults.addAll(doc.selectNodes("//link/@href"));
            //<script src="http://ar.atwola.com/file/adsWrapper.js">
            xpathResults.addAll(doc.selectNodes("//script/@src"));

            Map uniqueLinks = new HashMap();
            Iterator linkIter = xpathResults.iterator();
            while (linkIter.hasNext())
            {
View Full Code Here

            logger.trace("xml: " + xml);

            Document doc = DocumentHelper.parseText(xml);
            logger.trace("doc: " + doc);

            List<Node> templateNodes = doc.selectNodes("/template-list/template-info");
            logger.trace("templateNodes: " + templateNodes);

            for(Node node : templateNodes) {
                logger.trace("node: " + node);
View Full Code Here

            catch(Exception e) {
                // ignore
            }
            baseTemplate.setLabelProperty(doc.selectSingleNode("object-template/label-property").getStringValue());

            for(Object obj : doc.selectNodes("object-template/properties/object-property")) {
                logger.debug("obj: " + obj);

                if(obj instanceof Node) {
                    Node node = (Node)obj;
View Full Code Here

        assertNotNull(reply.getPayload());

        Document document = DocumentHelper.parseText(reply.getPayloadAsString());
        List nodes;

        nodes = document.selectNodes("//wsdl:definitions/wsdl:service");
        assertEquals(((Element)nodes.get(0)).attribute("name").getStringValue(), "AxisService");
    }

    protected String getConfigResources()
    {
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.