lua-users home
lua-l archive

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


Hi,
I am fairly new to Lua and trying to parse xmls with LuaXml

My xml  is like -

<users>
     <user>
           <id>1</id>
           <name> abc </name>
     </user>
      <user>
           <id>2</id>
           <name> xyz </name>
     </user>
</users>

 Say I want to list
 1)id of specific user 
 2)ids for all users

I performed-


local xfile = xml.load("UserXml.xml")

local users = xfile:find("user")

but table which is returned, consists value for first user only

I went through answer at -

http://stackoverflow.com/questions/17707777/luaxml-parse-the-xml-with-multiple-tags-with-the-same-name

but this looks much heavy in real time situations and as complex as performing string matching on xml file

Could you please suggest a simpler and efficient way to achieve this using LuaXml?