here is the code:
local xml = require("xmlSimple").newParser() local xmlbody = [[<body><message type='chat' read_type='1' from='gambo' to='gambo' ></message></body>]] local xmlTab = xml:ParseXmlText(xmlbody) print(xmlTab.body.message['@type']) print(xmlTab.body.message['@from']) print(xmlTab.body.message['@to']) print(xmlTab.body.message['@read_type'])
the result is:
table: 0xa462f0
gambo
gambo
nil
here is the code:
local xml = require("xmlSimple").newParser() local xmlbody = [[<body><message type='chat' read_type='1' from='gambo' to='gambo' ></message></body>]] local xmlTab = xml:ParseXmlText(xmlbody) print(xmlTab.body.message['@type']) print(xmlTab.body.message['@from']) print(xmlTab.body.message['@to']) print(xmlTab.body.message['@read_type'])
the result is: table: 0xa462f0 gambo gambo nil