|
> When I try to print out tbl[1][1]: Apart from the typo (cusomer_cnt instead of customer_cnt), I’m not sure what you expect from the call. This is what is contained in tbl: { [1] = " ", [2] = { [1] = " ", [2] = { [1] = " ", [2] = { [1] = "XYZ Market", ["attr"] = { }, ["tag"] = "CompanyName", }, [3] = " ", [4] = { [1] = "John Doe", ["attr"] = { }, ["tag"] = "ContactName", }, [5] = " ", [6] = { [1] = "Marketing Manager", ["attr"] = { }, ["tag"] = "ContactTitle", }, [7] = " ", [8] = { [1] = "(212) 555-1212", ["attr"] = { }, ["tag"] = "Phone", }, [9] = " ", [10] = { [1] = " ", [2] = { [1] = "100 Park Avenue.", ["attr"] = { }, ["tag"] = "Address", }, [3] = " ", [4] = { [1] = "New York", ["attr"] = { }, ["tag"] = "City", }, [5] = " ", [6] = { [1] = "NY", ["attr"] = { }, ["tag"] = "State", }, [7] = " ", ["attr"] = { }, ["tag"] = "FullAddress", }, [11] = " ", ["attr"] = { [1] = "CustomerID", ["CustomerID"] = "XYZ", }, ["tag"] = "Customer", }, [3] = " ", ["attr"] = { }, ["tag"] = "Customers", }, [3] = " ", ["attr"] = { }, ["tag"] = "Root", } Check the LuaExpat documentation [1] for details on the table format. Tom [1]
http://matthewwild.co.uk/projects/luaexpat/lom.html From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
On Behalf Of Jim zhang I try to use lxp.lom to parse xml file, but it gives empty table. Here is the code: -- setup XML parser testxml.xml file: <?xml
version="1.0" encoding="utf-8"?> Not sure what I did incorrectly here, I would like to get some help. Thank you very much! Jim |