lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Nov 16, 2016 at 2:32 PM, Xavier Wang <weasley.wx@gmail.com> wrote:
>     local result = table.match(sheetData,
>         [[ $[?(@.tag=="row")][?(@.tag=="c")] ]])
> ```

I did something like this in Penlight [1], just go down to 'Extracting
Data using Templates'

t = [[
  <weather>
    <current_conditions>
      <condition data='$condition'/>
      <temp_c data='$temp'/>
    </current_conditions>
  </weather>
]]

local res, ret = google:match(t)
pretty.dump(res)

And the output is:

{
  condition = "Clear",
  temp = "24"
}

1) http://stevedonovan.github.io/Penlight/api/manual/06-data.md.html#XML