Package org.apache.commons.jxpath

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


  public Iterator<?> xpathIterator(Collection<?> collection, String query) {
    JXPathContext pathContext = JXPathContext.newContext(collection);
    Iterator<?> result = null;

    try {
      result = pathContext.iteratePointers(query);
    } catch (JXPathNotFoundException e) {
      logger.log(Level.WARNING, "JXPath exception: {0}", e.getMessage());
    }

    return result;
View Full Code Here


        assertEquals("Bicycle", context.getValue("/things/thing[2]/@name"));
        assertEquals("Bicycle", context.getValue("/things/thing[last()]/@name"));

        List<Conf> things = new ArrayList<Conf>();
        Iterator thingsIt = context.iteratePointers("things/thing[position() < 3]");
        while (thingsIt.hasNext()) {
            Pointer pointer = (Pointer)thingsIt.next();
            assertTrue(pointer.getNode() instanceof Conf);
            things.add((Conf)pointer.getNode());
        }
View Full Code Here

        if (ptr.getNode() != null) {
            // There are some nodes to load from

            JXPathContext repeaterContext = jctx.getRelativeContext(ptr);
            // build a jxpath iterator for pointers
            Iterator rowPointers = repeaterContext.iteratePointers(this.rowPath);

            //iterate through it
            int rowNum = 0;
            while (rowPointers.hasNext()) {
                // Get a row. It is created if needed (depends on clearOnLoad)
View Full Code Here

            // Move to the list location
            ctx = JXPathContext.newContext(flowData);

            // Iterate on all elements of the list
            iter = ctx.iteratePointers(this.listPath);
        } else {
            // Move to the list location
            ctx = JXPathContext.newContext(model);

            // Iterate on all elements of the list
View Full Code Here

        } else {
            // Move to the list location
            ctx = JXPathContext.newContext(model);

            // Iterate on all elements of the list
            iter = ctx.iteratePointers(".");
        }

        // Start the selection-list
        contentHandler.startElement(FormsConstants.INSTANCE_NS, SELECTION_LIST_EL, FormsConstants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
        if( this.nullable ) {
View Full Code Here

            int initialSize = repeater.getSize();

            // build a jxpath iterator for pointers
            JXPathContext repeaterContext = jxpc.getRelativeContext(ptr);
            Iterator rowPointers = repeaterContext.iteratePointers(this.rowPath);
            //iterate through it
            while (rowPointers.hasNext()) {
                // create a new row, take that as the frmModelSubContext
                Repeater.RepeaterRow thisRow;
                if (initialSize > 0) {
View Full Code Here

            // Get the identity
            List identity = getIdentity(thisRow);
           
            if (hasNonNullElements(identity)) {
                // iterate nodes to find match
                Iterator rowPointers = repeaterContext.iteratePointers(this.rowPath);
                boolean found = false;
                while (rowPointers.hasNext()) {
                    Pointer jxp = (Pointer) rowPointers.next();
                    JXPathContext rowContext = repeaterContext.getRelativeContext(jxp);
                    List contextIdentity = getIdentity(rowContext);
View Full Code Here

        // Unfortunately the following statement doesn't work (it doesn't removes all elements from the
        // list because of a bug in JXPath I wasn't able to locate).
        //multiValueContext.removeAll(this.rowPath);
       
        // TODO: This is a workaround until the bug in commons-jxpath is found, fixed and released
        Iterator rowPointers = multiValueContext.iteratePointers(this.rowPath);
        int cnt = 0;
        while( rowPointers.hasNext() )
        {
            cnt++;
            rowPointers.next();
View Full Code Here

            // Narrow to repeater context.
            JXPathContext repeaterContext = jctx.getRelativeContext(repeaterPointer);

            // Build a jxpath iterator for the repeater row pointers.
            Iterator rowPointers = repeaterContext.iteratePointers(this.rowPath);

            // Iterate through the rows of data.
            int rowNum = 0;
            while (rowPointers.hasNext()) {
View Full Code Here

        // Unfortunately the following statement doesn't work (it doesn't removes all elements from the
        // list because of a bug in JXPath I wasn't able to locate).
        //multiValueContext.removeAll(this.rowPath);

        // TODO: This is a workaround until the bug in commons-jxpath is found, fixed and released
        Iterator rowPointers = multiValueContext.iteratePointers(this.rowPath);
        int cnt = 0;
        while( rowPointers.hasNext() )
        {
            cnt++;
            rowPointers.next();
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.