Commons JXPath
  1. Commons JXPath
  2. JXPATH-108

problems with NodeSet returned from custom function.

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.3
    • Labels:
      None

      Description

      If a NodeSet (BasicNodeSet) is returned from a custom function,
      count() does not work and returns always 1.

      Perhaps could be added In ri.compiler.CoreFunction.java, method functionCount(EvalContext)

      else if (value instanceof Collection)

      {... }

      else if (value instanceof NodeSet)

      { count = ((NodeSet) value).getValues().size(); }

      or similiar.

        Activity

        Michele Vivoda created issue -
        Hide
        Michele Vivoda added a comment -

        lowered priority..

        Show
        Michele Vivoda added a comment - lowered priority..
        Michele Vivoda made changes -
        Field Original Value New Value
        Priority Blocker [ 1 ] Minor [ 4 ]
        Matt Benson made changes -
        Description If a NodeSet (SimpleNodeSet) is returned from a custom function,
        count() does not work and returns always 1.

        Perhaps could be added In ri.compiler.CoreFunction.java, method functionCount(EvalContext)

        else if (value instanceof Collection) {... }
        else if (value instanceof NodeSet) {
                    count = ((NodeSet) value).getValues().size();
                }

        or similiar.

        If a NodeSet (BasicNodeSet) is returned from a custom function,
        count() does not work and returns always 1.

        Perhaps could be added In ri.compiler.CoreFunction.java, method functionCount(EvalContext)

        else if (value instanceof Collection) {... }
        else if (value instanceof NodeSet) {
                    count = ((NodeSet) value).getValues().size();
                }

        or similiar.

        Hide
        Matt Benson added a comment -

        Fixed. Thanks!

        Show
        Matt Benson added a comment - Fixed. Thanks!
        Matt Benson made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Matt Benson made changes -
        Fix Version/s 1.3 [ 12312253 ]
        Affects Version/s 1.3 [ 12312253 ]
        Affects Version/s Nightly Builds [ 12311823 ]
        Matt Benson made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Matt Benson added a comment -

        Additional problem reported by M. Vivoda:
        selecting a single value from a returned NodeSet returns the nodeset rather than treating as a valid part of the xpath graph. User suggested fix for both issues (obviating the fix in CoreFunction) to convert the NodeSet to an EvalContext when the extension function is called. I agree with the analysis.

        Show
        Matt Benson added a comment - Additional problem reported by M. Vivoda: selecting a single value from a returned NodeSet returns the nodeset rather than treating as a valid part of the xpath graph. User suggested fix for both issues (obviating the fix in CoreFunction) to convert the NodeSet to an EvalContext when the extension function is called. I agree with the analysis.
        Matt Benson made changes -
        Summary count() on NodeSet returned from custom function. problems with NodeSet returned from custom function.
        Description If a NodeSet (BasicNodeSet) is returned from a custom function,
        count() does not work and returns always 1.

        Perhaps could be added In ri.compiler.CoreFunction.java, method functionCount(EvalContext)

        else if (value instanceof Collection) {... }
        else if (value instanceof NodeSet) {
                    count = ((NodeSet) value).getValues().size();
                }

        or similiar.

        If a NodeSet (BasicNodeSet) is returned from a custom function,
        count() does not work and returns always 1.

        Perhaps could be added In ri.compiler.CoreFunction.java, method functionCount(EvalContext)

        else if (value instanceof Collection) {... }
        else if (value instanceof NodeSet) {
                    count = ((NodeSet) value).getValues().size();
                }

        or similiar.
        Hide
        Matt Benson added a comment -

        svn rev 604261.

        Show
        Matt Benson added a comment - svn rev 604261.
        Matt Benson made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Resolved [ 5 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        4h 30m 1 Matt Benson 11/Dec/07 23:24
        Resolved Resolved Reopened Reopened
        2d 19h 20m 1 Matt Benson 14/Dec/07 18:45
        Reopened Reopened Resolved Resolved
        24m 10s 1 Matt Benson 14/Dec/07 19:09

          People

          • Assignee:
            Unassigned
            Reporter:
            Michele Vivoda
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development