I need to list the text inside these two elements in the many `pom.xml` in a directory tree. The files may contain the element at other places too, I am only looking for the content of these two. 

Ideally, I am looking for a tool that outputs in the format `<file-name>:<line-no>:<path>:<text>`, e.g.

```
parent/pom.xml:12:/project/groupId:com.acme.project
features/persist/pom.xml:14:/project/parent/groupId:com.acme.project
features/persist/pom.xml:32:/project/groupId:com.acme.project.persist

```

For the following input files:

```
**parent/pom/xml**
<project>
 ...
  <groupId>
  com.acme.project <!--LINE 12 --> 
  </groupId>
...
</project>

**feature/persist/pom.xml**
<project>
  <parent>
    <groupId>
    com.acme.project <!--LINE 14 --> 
    </groupId>
  </parent>
  ...
  <groupId>
  com.acme.project
  </groupId>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>
        a.b.c.d <!-- this is not listed in output -->
        </groupId>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

```

Note that other paths such as `dependencyManagement/dependencies/dependency/groupId` are not included.

Searching here on SO I came across [`xmllint --xpath`](https://stackoverflow.com/questions/91791/grep-and-sed-equivalent-for-xml-command-line-processing/14492020?noredirect=1#comment22971123_14492020) and [xmlstarlet](/questions/tagged/xmlstarlet "show questions tagged 'xmlstarlet'") but I don't know enough about xpath to figure this out myself.