03.12.2020, 06:35 
		
	
	
		Use this:
It will produce a table containing all the event data:
	
	
	
	
Code:
function starttag(p, tag, attrs)
  if tag == 'event' then
    eventdata = attrs
  elseif not done and eventdata then
    ctag = tag
  end
end
function endtag(p, tag)
  if tag == 'event' then
    done = true
  elseif tag == ctag then
    ctag = nil
  end
end
function text(p, tdata)
  if ctag then
    eventdata[ ctag ] = tdata:trim()
  end
end
data = '<?xml version="1.0" encoding="UTF-8"?><sbn_rd xmlns="http://www.ibsiberia.com/schemas/sbn_rd" version="1"><event id="1476139372" protocol="CID"><account>2034</account><code>E130</code><zone>1</zone><area>1</area></event></sbn_rd>'
require('lxp').new({
  StartElement = starttag,
  EndElement = endtag,
  CharacterData = text,
}):parse(data)
log(eventdata)It will produce a table containing all the event data:
Code:
* table:
 [1]
  * string: id
 [2]
  * string: protocol
 ["area"]
  * string: 1
 ["code"]
  * string: E130
 ["account"]
  * string: 2034
 ["protocol"]
  * string: CID
 ["id"]
  * string: 1476139372
 ["zone"]
  * string: 1 
 

