Package org.apache.commons.jxpath.ri

Examples of org.apache.commons.jxpath.ri.QName


            setStarted = true;
            if (!(nodeTest instanceof NodeNameTest)) {
                return false;
            }

            QName testName = ((NodeNameTest) nodeTest).getNodeName();
            if (testName.getPrefix() != null) {
                return false;
            }
            String testLocalName = testName.getName();
            if (testLocalName.equals("*")) {
                iterator =
                    parentContext.getCurrentNodePointer().namespaceIterator();
            }
            else {
View Full Code Here


        boolean reverse,
        int expected)
    {
        PropertyOwnerPointer root =
            (PropertyOwnerPointer) NodePointer.newNodePointer(
                new QName(null, "root"),
                createContextBean(),
                Locale.getDefault());

        NodeIterator it;

        PropertyPointer start = null;

        if (useStartLocation) {
            start = root.getPropertyPointer();
            start.setPropertyIndex(
                relativeProperty(start, relativePropertyIndex));
            start.setIndex(offset);
        }
        it =
            root.childIterator(
                new NodeNameTest(new QName(null, "integers")),
                reverse,
                start);

        int size = 0;
        while (it.setPosition(it.getPosition() + 1)) {
View Full Code Here

        boolean reverse,
        int expected)
    {
        PropertyOwnerPointer root =
            (PropertyOwnerPointer) NodePointer.newNodePointer(
                new QName(null, "root"),
                createContextBean(),
                Locale.getDefault());
        NodeIterator it;

        PropertyPointer start = null;
View Full Code Here

    /**
     * Tests to iterate over all attributes.
     */
    public void testIterateAllAttributes()
    {
        ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer, new QName(null, "*"));
        assertEquals("Wrong number of attributes", 2, iteratorSize(it));
        List attrs = iterationElements(it);
        assertEquals("Wrong first attribute", ATTR_NAME, ((ConfigurationNode) attrs.get(0)).getName());
        assertEquals("Wrong first attribute", TEST_ATTR, ((ConfigurationNode) attrs.get(1)).getName());
    }
View Full Code Here

    /**
     * Tests to iterate over attributes with a specific name.
     */
    public void testIterateSpecificAttribute()
    {
        ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer, new QName(null, TEST_ATTR));
        assertEquals("Wrong number of attributes", 1, iteratorSize(it));
        assertEquals("Wrong attribute", TEST_ATTR, ((ConfigurationNode) iterationElements(it).get(0)).getName());
    }
View Full Code Here

    /**
     * Tests to iterate over non existing attributes.
     */
    public void testIterateUnknownAttribute()
    {
        ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer, new QName(null, "unknown"));
        assertEquals("Found attributes", 0, iteratorSize(it));
    }
View Full Code Here

     * Tests iteration when a namespace is specified. This is not supported, so
     * the iteration should be empty.
     */
    public void testIterateNamespace()
    {
        ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer, new QName("test", "*"));
        assertEquals("Found attributes", 0, iteratorSize(it));
    }
View Full Code Here

            assertEquals("Wrong child", node.getChild(index - 1), pchild
                    .getNode());
            checkIterators(pchild);
        }

        it = p.attributeIterator(new QName(null, "*"));
        assertEquals("Iterator count differs from attribute count", node
                .getAttributeCount(), iteratorSize(it));
        for (int index = 1; it.setPosition(index); index++)
        {
            NodePointer pattr = it.getNodePointer();
View Full Code Here

    /**
     * Tests using a node test with a wildcard name.
     */
    public void testIterateWithWildcardTest()
    {
        NodeNameTest test = new NodeNameTest(new QName(null, "*"));
        ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
                rootPointer, test, false, null);
        assertEquals("Wrong number of elements", CHILD_COUNT, iteratorSize(it));
    }
View Full Code Here

     * Tests using a node test that defines a namespace prefix. Because
     * namespaces are not supported, no elements should be in the iteration.
     */
    public void testIterateWithPrefixTest()
    {
        NodeNameTest test = new NodeNameTest(new QName("prefix", "*"));
        ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
                rootPointer, test, false, null);
        assertNull("Undefined node pointer not returned", it.getNodePointer());
        assertEquals("Prefix was not evaluated", 0, iteratorSize(it));
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.ri.QName

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.