Package org.dom4j.xpath

Examples of org.dom4j.xpath.DefaultXPath


    }

    public void testBooleanValueOf() throws Exception {
        Document doc = DocumentHelper.parseText("<root><foo>blah</foo></root>");

        XPath path = new DefaultXPath("//root");
        assertTrue(path.booleanValueOf(doc));

        path = new DefaultXPath("//root2");
        assertFalse(path.booleanValueOf(doc));
    }
View Full Code Here


        };

        Rule r = new Rule(pattern, action);
        s.addRule(r);

        s.applyTemplates(document, new DefaultXPath("root/author/url"));

        assertEquals("Check url is processed twice", "urlurl", b.toString());
    }
View Full Code Here

/*     */   }
/*     */
/*     */   public XPath createXPath(String xpathExpression)
/*     */     throws InvalidXPathException
/*     */   {
/* 230 */     DefaultXPath xpath = new DefaultXPath(xpathExpression);
/*     */
/* 232 */     if (this.xpathNamespaceURIs != null) {
/* 233 */       xpath.setNamespaceURIs(this.xpathNamespaceURIs);
/*     */     }
/*     */
/* 236 */     return xpath;
/*     */   }
View Full Code Here

    private static void filterWebXml(WebArchive webArchive, File explodedWarFile) {
        try {
            SAXReader reader = new SAXReader();
            Document document = reader.read(new File(explodedWarFile.getPath() + "/WEB-INF/web.xml"));
            // Keep in sync with guvnor-distribution-wars/src/main/config-processor-filter/jboss-as-7_0/web_xml-filter.xml
            DefaultXPath xpath = new DefaultXPath("//j:context-param[j:param-name/text()=\"resteasy.injector.factory\"]");
            Map<String,String> namespaces = new TreeMap<String,String>();
            namespaces.put("j","http://java.sun.com/xml/ns/javaee");
            xpath.setNamespaceURIs(namespaces);

            Node node =  xpath.selectSingleNode(document);
            node.detach();
            File filteredWebXml = new File("target/test/filtered/jboss-as-7_0/WEB-INF/web.xml");
            filteredWebXml.getParentFile().mkdirs();
            FileWriter writer = null;
            try {
View Full Code Here

TOP

Related Classes of org.dom4j.xpath.DefaultXPath

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.