Commons JXPath
  1. Commons JXPath
  2. JXPATH-57

evaluate xpath expressions in functions

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1 Final
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

      Description

      It is not clear in the doc comments how to call a function in such a way that
      certain parameters are evaluated as XPath expressions before being passed to
      the method.

      For example, in the PackageFunctions doc comments, it gives the example:

      "util:substring('foo', 1, 2)" is equivalent to "foo".substring(1, 2)

      which is not an especially useful example, as both are inefficient equivalents
      of the expression "fo".

      A more interesting example involve an expression like:

      "util:substring('person/name/middleName', 1, 1)"

      which could be used to get the middle initial of a person. The problem is how
      to indicate that this should be context.getJXPathContext().getValue
      ("person/name/middleName").substring(1, 1) instead
      of "person/name/middleName".substring(1, 1).

      Without the facility to indicate that some parameters are XPath expressions,
      existing methods cannot be used without writing wrapper methods to evaluate
      the XPath expressions.

      If such a facility already exists, the doc comments of PackageFunctions, etc.
      should be updated to describe it.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kevin Wong
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development