[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: luaexpat, handling entities
- From: "Elbers, H.P." <H.P.Elbers@...>
- Date: Thu, 12 Mar 2009 15:07:53 +0100
Hello,
I'm using luaexpat
(from the Kepler project) to parse xml files that contain entities like
These cause the
parser to abort with the error 'undefined entity'...
Is the a way to tell
luaexpat to handle these errors 'gently', or do I have to preprocess the input
to catch them?
Thanks,
Hans.
Example:
#!/usr/bin/env lua
require("lxp")
function
doStart(parser, name, attr) print('start of', name)
end
data =
''
local xml =
lxp.new{ StartElement = doStart}
a,b =
xml:parse(data)
if not a then
local l,c = xml:pos()
print(string.format("ERROR: [%d,%d] %s", l, c, b))
else
xml:close()
end
Output:
start of
aa
start of bb
start
of cc
ERROR: [1,34] undefined
entity