require 'lxp' data = [[
Invisibility Cream 14.50 Makes you invisible Levitation Salve 23.99 Levitate yourself for up to 3 hours per application
Blork and Freen Instameal 4.95 A tasty meal in a tablet; just add water Grob winglets 3.56 Tender winglets of Grob. Just add water
]] local first = true local names, prices = {}, {} p = lxp.new({StartElement = function (parser, name) local a, b, c = parser:pos() --line, offset, pos if name == 'item' and first then print(data:match('.-', c - b + 1)) first = false end if name == 'name' then names[#names+1] = data:match('>(.-)<', c) end if name == 'price' then prices[#prices+1] = data:match('>(.-)<', c) end end}) p:parse(data) p:close() print('Name: ', table.concat(names, ', ')) print('Price: ', table.concat(prices, ', '))