Extract data from xml file

Hello,

I want to dynamically extract information from an xml file, something like this:

<bookmarket> <book> <title>T1</title> </book> <book> <title>T2</title> </book> </bookmarket>

I've created a filter:

filter {

xml {
source => "message"
target => "source"
store_xml => false
remove_namespaces => true
xpath => [
#here I don't know the number of books in the xml file
"count(bookstore/step)","number_of_books"
#I want to create something like this:
for counter in [1.. %{number_of_books}] {
"bookmarket/book[counter]/title/text()", "bookTitle[counter]"
}
]
force_array => false
}
}

Thank you for your help.

This seems more like an XPath question that's probably better asked where XPath experts hang out.

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