Package org.apache.commons.jxpath

Examples of org.apache.commons.jxpath.JXPathContext.selectNodes()


        trans.transform(source, result);
        Node root = ((Document) result.getNode()).getDocumentElement();
        JXPathContext ctx = JXPathContext.newContext(root);

        assertEquals("Wrong name of root element", "database", root.getNodeName());
        assertEquals("Wrong number of children of root", 1, ctx.selectNodes(
                "/*").size());
        assertEquals("Wrong number of tables", 2, ctx.selectNodes(
                "/tables/table").size());
        assertEquals("Wrong name of first table", "users", ctx
                .getValue("/tables/table[1]/name"));
View Full Code Here


        JXPathContext ctx = JXPathContext.newContext(root);

        assertEquals("Wrong name of root element", "database", root.getNodeName());
        assertEquals("Wrong number of children of root", 1, ctx.selectNodes(
                "/*").size());
        assertEquals("Wrong number of tables", 2, ctx.selectNodes(
                "/tables/table").size());
        assertEquals("Wrong name of first table", "users", ctx
                .getValue("/tables/table[1]/name"));
        assertEquals("Wrong number of fields in first table", 5, ctx
                .selectNodes("/tables/table[1]/fields/field").size());
View Full Code Here

                "/*").size());
        assertEquals("Wrong number of tables", 2, ctx.selectNodes(
                "/tables/table").size());
        assertEquals("Wrong name of first table", "users", ctx
                .getValue("/tables/table[1]/name"));
        assertEquals("Wrong number of fields in first table", 5, ctx
                .selectNodes("/tables/table[1]/fields/field").size());
        assertEquals("Wrong attribute value", "system", ctx
                .getValue("/tables/table[1]/@tableType"));
    }
}
View Full Code Here

        {
            JXPathContext context = createContext(root, key);
            // This is safe because our node pointer implementations will return
            // a list of configuration nodes.
            @SuppressWarnings("unchecked")
            List<ConfigurationNode> result = context.selectNodes(key);
            if (result == null)
            {
                result = Collections.emptyList();
            }
            return result;
View Full Code Here

        trans.transform(source, result);
        Node root = ((Document) result.getNode()).getDocumentElement();
        JXPathContext ctx = JXPathContext.newContext(root);

        assertEquals("Wrong root name", rootName, root.getNodeName());
        assertEquals("Wrong number of children", 3, ctx.selectNodes("/*").size());

        check(ctx, "world/continents/continent", CONTINENTS);
        check(ctx, "world/greeting", new String[] { "Hello", "Salute" });
        check(ctx, "world/wish", "Peace");
        check(ctx, "application/mail/smtp", "smtp.mymail.org");
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.