groovy
  1. groovy
  2. GROOVY-5437

ERROR: parents() not implemented yet

    Details

    • Type: Improvement Improvement
    • Status: Reopened Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.8.6
    • Fix Version/s: None
    • Component/s: groovy-jdk
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Looks like the parents() implemention has been missing since 2006. Perhaps it is forgotten? Would be a useful method to have.

      d0b473f5 paulk-asert
      2006-10-21 add '**' to DOMCategory and XmlParser 163
      164 public GPathResult parents() {
      165 // TODO Auto-generated method stub
      166 throw new GroovyRuntimeException("parents() not implemented yet");

        Activity

        Hide
        Paul King added a comment -

        What use case do you have in mind?

        Show
        Paul King added a comment - What use case do you have in mind?
        Hide
        Uri Moszkowicz added a comment -

        I've used it in a few ways. One is to gather up a list of @name attributes for all nodes leading up to one so that it can be uniquely identified. Another is to inherit attributes from ancestor nodes.

        Show
        Uri Moszkowicz added a comment - I've used it in a few ways. One is to gather up a list of @name attributes for all nodes leading up to one so that it can be uniquely identified. Another is to inherit attributes from ancestor nodes.
        Hide
        Paul King added a comment -

        Your use cases make sense. There is a little bit of complication with how XmlSlurper defines parent() which is why there is currently no implementation for parents(). For DOMCategory and XmlParser, parent() means walk up the "DOM" tree one level. For XmlSlurper, it means unravel one level of GPathResult. If you have a GPath expression walking down the XML nodes, it amounts to the same thing but that is not always the case with GPath expressions.

        Show
        Paul King added a comment - Your use cases make sense. There is a little bit of complication with how XmlSlurper defines parent() which is why there is currently no implementation for parents(). For DOMCategory and XmlParser, parent() means walk up the "DOM" tree one level. For XmlSlurper, it means unravel one level of GPathResult. If you have a GPath expression walking down the XML nodes, it amounts to the same thing but that is not always the case with GPath expressions.
        Hide
        Pascal Schumacher added a comment -

        The parents() method for GPathResult was implemented for GROOVY-6125.

        Show
        Pascal Schumacher added a comment - The parents() method for GPathResult was implemented for GROOVY-6125 .
        Hide
        Paul King added a comment -

        parents() or parent()?

        Show
        Paul King added a comment - parents() or parent()?
        Hide
        Pascal Schumacher added a comment -

        Paul is correct. I mixed up parent() (which was added by GROOVY-6125) and parents() which still is not implemented.

        Show
        Pascal Schumacher added a comment - Paul is correct. I mixed up parent() (which was added by GROOVY-6125 ) and parents() which still is not implemented.

          People

          • Assignee:
            Unassigned
            Reporter:
            Uri Moszkowicz
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: