-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
In files containing a BOM (utf <feff>) at the beginning of the file, parseXmlDeclaration in XmlParser.lua will error thinking that the XML declaration is not at the beginning of the string.
local xml2lua = require("xml2lua")
local handler = require("xmlhandler.tree")
local h = handler:new()
local parser = xml2lua.parser(h)
parser:parse("<?xml version=\"1.0\" encoding=\"utf-8\"?>")Running this snippet (ensure you copy and paste, as there is an invisible BOM right before the <) will produce the following output:
./xml2lua.lua:92: XMLDecl not at start of document [char=1]
stack traceback:
[C]: in function 'error'
./xml2lua.lua:92: in field 'errorHandler'
./XmlParser.lua:133: in upvalue 'err'
./XmlParser.lua:194: in upvalue 'parseXmlDeclaration'
./XmlParser.lua:347: in upvalue 'parseTagType'
./XmlParser.lua:429: in function 'XmlParser.parse'
stdin:6: in main chunk
[C]: in ?```
Metadata
Metadata
Assignees
Labels
No labels