Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-57

evaluate xpath expressions in functions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.1 Final
    • None
    • None
    • Operating System: Windows XP
      Platform: PC

    • 30298

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kwongfu@hotmail.com Kevin Wong
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: