I am using XmlSlurper to parse an XML file for processing. I need to find the line number, of some matching criteria, within the file.
Here is what I have so far:
def void findServlets() {
this.servlets = webFile.depthFirst().findAll{
it.name() == 'servlet'
}
println this.servlets
}
Now I need to find the correlating line number for every matching 'servlet'. Using a SaxParser, I would do the following:
node.getUserData(SaxParser.KEY_LINE_NO)
How would I accomplish the same task on a GpathResult in groovy ?
Many thanks, Michael