How to parse and iterate consecutive XML same id tag values

I have an xml where the xpath I'm interested eted in looks like as

/get_reports_response[1]/report[1]/report[1]/results[1]/result[12]

and under result i have children like

  • [name: ]
  • [owner: +]
  • [name: ]
  • [comment: ]
  • [creation_time: +]
  • [modification_time:]

So the number 12 record tag and the depth to which parent tag "report" can be is dynamic and is not in my control, the result is based upon scan results from a tool. Depending upon number of assets scan the result count can vary.

I want to start with

....

xml {
source => "inxml"
#target => "xmldata"
store_xml => "false"
xpath => ["/get_reports_response[1]/report[1]/report[1]/results[1]/result[12]/name/text()","senderid"]
}

I dont' want to repeat each xpath for each scan results which is "result[n]". For e.g above i want to pick names for every result count, do I need to loop. How can i made code dynamic. THANKS.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.