lua-users home
lua-l archive

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


Not sure if this fits your needs but I have used LuaXML with good results:

http://viremo.eludi.net/LuaXML/

It's C so you'll have to account for building the binary. I had to patch my lua build to include -fPIC to support it but that was on FreeBSD. I now ensure that flag is included in all my builds including GNU/Linux. 

Russ

Sent from my BlackBerry 10 smartphone on the Koodo network.
  Original Message  
From: Luiz Henrique de Figueiredo
Sent: Monday, August 8, 2016 12:20 PM
To: Lua mailing list
Reply To: Lua mailing list
Subject: Re: Parsing XML

> How can I access the document via element names instead?

Get my lxml at
http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/index.html#lxml

Replace the dump function in test.lua by the code below.
It seemed to work for me. Adapt as needed.

local interest={
["vuln:cve-id"]=true,
["cvss:score"]=true,
["cpe-lang:fact-ref"]=true,
}

local function dump(t)
for k,v in pairs(t) do
if interest[k] then print(k,v) end
end
for k,v in ipairs(t) do
if type(v)=="table" then
dump(v)
end
end
end