Package org.dom4j

Examples of org.dom4j.XPath.selectNodes()


    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "entity-name" ).getText(),"org.hibernate.tool.hbm2x.hbm2hbmxml.Group");


    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/set");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get one set element", 1, list.size());
    node = (Element) list.get(0);
    assertEquals(node.attribute( "table" ).getText(),"UserGroup");

View Full Code Here


         SAXReader xmlReader =  this.getSAXReader();

        Document document = xmlReader.read(outputXml);

        XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class");
         List list = xpath.selectNodes(document);
        assertEquals("Expected to get one class element", 1, list.size());
         Element node = (Element) list.get(0);

        assertEquals(node.attribute( "table" ).getText(),"`Group`");
View Full Code Here

         Element node = (Element) list.get(0);

        assertEquals(node.attribute( "table" ).getText(),"`Group`");

        xpath = DocumentHelper.createXPath("//hibernate-mapping/class/composite-id");
        list = xpath.selectNodes(document);
        assertEquals("Expected to get one composite-id element", 1, list.size());


        xpath = DocumentHelper.createXPath("//hibernate-mapping/class/composite-id/key-property");
         list = xpath.selectNodes(document);
View Full Code Here

        list = xpath.selectNodes(document);
        assertEquals("Expected to get one composite-id element", 1, list.size());


        xpath = DocumentHelper.createXPath("//hibernate-mapping/class/composite-id/key-property");
         list = xpath.selectNodes(document);
        assertEquals("Expected to get two key-property elements", 2, list.size());
         node = (Element) list.get(0);
        assertEquals(node.attribute( "name" ).getText(),"name");
        node = (Element) list.get(1);
        assertEquals(node.attribute( "name" ).getText(),"org");
View Full Code Here

          Document document;
          try {
            document = xmlReader.read(outputXml);
            XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/set");
            List list = xpath.selectNodes(document);
            assertEquals("Expected to get one set element", 1, list.size());
            Element node = (Element) list.get(0);
            assertEquals(node.attribute( "table" ).getText(),"UserGroup");
            assertEquals(node.attribute( "name" ).getText(),"users");
            assertEquals(node.attribute( "inverse" ).getText(),"true");
View Full Code Here

        }

        getLogger().debug("XPATH: " + xpath_string);

        XPath xpathSelector = DocumentHelper.createXPath(xpath_string);
        List nodes = xpathSelector.selectNodes(doc);

        if (nodes.isEmpty()) {
            getLogger().error(".act(): No nodes: " + xpath_string);
            getLogger().error(".act(): No child added!");
View Full Code Here

        SimpleNamespaceContext context = new SimpleNamespaceContext();
        context.addNamespace("xplt", "www.xxxx.com");
        context.addNamespace("xpl", "www.xxxx.com");
        xpath.setNamespaceContext(context);

        List list = xpath.selectNodes(document);

        log("Searched path: " + xpathText + " found: " + list.size()
                + " result(s)");

        assertTrue("Should have found at lest one result", list.size() > 0);
View Full Code Here

        }
    }

    protected void testXPath(String xpathText) {
        XPath xpath = createXPath(xpathText);
        List list = xpath.selectNodes(document);

        log("Searched path: " + xpathText + " found: " + list.size()
                + " result(s)");

        assertTrue("Results should not contain the root node", !list
View Full Code Here

    // Implementation methods
    // -------------------------------------------------------------------------
    protected void testXPath(String xpathText) {
        XPath xpath = DocumentHelper.createXPath(xpathText);
        List list = xpath.selectNodes(document);

        log("Searched path: " + xpathText + " found: " + list.size()
                + " result(s)");

        for (Iterator iter = list.iterator(); iter.hasNext();) {
View Full Code Here

    // Implementation methods
    // -------------------------------------------------------------------------
    protected void testXPath(String xpathText) {
        XPath xpath = DocumentHelper.createXPath(xpathText);
        List list = xpath.selectNodes(document);

        log("Searched path: " + xpathText + " found: " + list.size()
                + " result(s)");

        for (Iterator iter = list.iterator(); iter.hasNext();) {
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.