Package org.jaxen

Examples of org.jaxen.BaseXPath.selectNodes()


        String url = TESTS_ROOT + "xml/text.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            assertCountXPath(3, context, "/foo/bar/text()");
            assertValueOfXPath("baz", context, "normalize-space(/foo/bar/text())");
View Full Code Here


        String url = TESTS_ROOT + "xml/testNamespaces.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            /* the root is not an element, so no namespaces
            */
 
View Full Code Here

        String url = TESTS_ROOT + "xml/testNamespaces.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/Template/Application1", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            /* must count the default xml: prefix as well
            */
 
View Full Code Here

        String url = TESTS_ROOT + "xml/testNamespaces.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            /* namespace nodes have their element as their parent
            */
 
View Full Code Here

        String url = TESTS_ROOT + "xml/testNamespaces.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/Template/namespace::xml", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            assertCountXPath(1, context, "parent::Template");
        }
View Full Code Here

    protected Object assertCountXPath2(int expectedSize, Object context, String xpathStr)
            throws JaxenException {
        log(debug,
            "  Select :: " + xpathStr);
        BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());
        List results = xpath.selectNodes(getContext(context));
        log(debug,
            "    Expected Size :: " + expectedSize);
        log(debug,
            "    Result Size   :: " + results.size());
        if (expectedSize != results.size()) {
View Full Code Here

    protected void assertInvalidXPath(Object context, String xpathStr) {
        try {
            log(debug,
                "  Select :: " + xpathStr);
            BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());
            List results = xpath.selectNodes(getContext(context));
            log(debug,
                "    Result Size   :: " + results.size());
            fail("An exception was expected.");
        }
        catch (UnsupportedAxisException e) {
View Full Code Here

        String url = TESTS_ROOT + "xml/jaxen3.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext())
        {
            Object context = iter.next();
            assertCountXPath(1, context, "/Configuration/hostname/attrlist/hostname[. = 'CE-A'] ");
View Full Code Here

        String url = TESTS_ROOT + "xml/numbers.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext())
        {
            Object context = iter.next();
            /* repeated xpaths, jaxen-35
View Full Code Here

        String url = TESTS_ROOT + "xml/underscore.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext())
        {
            Object context = iter.next();
            assertCountXPath(1, context, "/root/@a");
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.