Skip to content

Commit

Permalink
update xml2lua library
Browse files Browse the repository at this point in the history
  • Loading branch information
elkangaroo committed Jun 9, 2024
1 parent 03fad57 commit 6f3c0d5
Show file tree
Hide file tree
Showing 6 changed files with 290 additions and 292 deletions.
143 changes: 0 additions & 143 deletions lib/ext/xml2lua/README.adoc

This file was deleted.

10 changes: 5 additions & 5 deletions lib/ext/xml2lua/XmlParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local function hexadecimalToHtmlChar(code)
end

local XmlParser = {
-- Private attribures/functions
-- Private attributes/functions
_XML = '^([^<]*)<(%/?)([^>]-)(%/?)>',
_ATTR1 = '([%w-:_]+)%s*=%s*"(.-)"',
_ATTR2 = '([%w-:_]+)%s*=%s*\'(.-)\'',
Expand All @@ -56,10 +56,10 @@ local XmlParser = {
_WS = '^%s*$',
_DTD1 = '<!DOCTYPE%s+(.-)%s+(SYSTEM)%s+["\'](.-)["\']%s*(%b[])%s*>',
_DTD2 = '<!DOCTYPE%s+(.-)%s+(PUBLIC)%s+["\'](.-)["\']%s+["\'](.-)["\']%s*(%b[])%s*>',
--_DTD3 = '<!DOCTYPE%s+(.-)%s*(%b[])%s*>',
_DTD3 = '<!DOCTYPE%s.->',
_DTD3 = '<!DOCTYPE%s+(.-)%s+%[%s+.-%]>', -- Inline DTD Schema
_DTD4 = '<!DOCTYPE%s+(.-)%s+(SYSTEM)%s+["\'](.-)["\']%s*>',
_DTD5 = '<!DOCTYPE%s+(.-)%s+(PUBLIC)%s+["\'](.-)["\']%s+["\'](.-)["\']%s*>',
_DTD6 = '<!DOCTYPE%s+(.-)%s+(PUBLIC)%s+["\'](.-)["\']%s*>',

--Matches an attribute with non-closing double quotes (The equal sign is matched non-greedly by using =+?)
_ATTRERR1 = '=+?%s*"[^"]*$',
Expand Down Expand Up @@ -157,7 +157,7 @@ end
--@param s String containing tag text
--@return a {name, attrs} table
-- where name is the name of the tag and attrs
-- is a table containing the atributtes of the tag
-- is a table containing the attributes of the tag
local function parseTag(self, s)
local tag = {
name = string.gsub(s, self._TAG, '%1'),
Expand Down Expand Up @@ -246,7 +246,7 @@ end

local function _parseDtd(self, xml, pos)
-- match,endMatch,root,type,name,uri,internal
local dtdPatterns = {self._DTD1, self._DTD2, self._DTD3, self._DTD4, self._DTD5}
local dtdPatterns = {self._DTD1, self._DTD2, self._DTD3, self._DTD4, self._DTD5, self._DTD6}

for _, dtd in pairs(dtdPatterns) do
local m,e,r,t,n,u,i = string.find(xml, dtd, pos)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package = "xml2lua"
version = "1.5-2"
version = "1.6-2"
source = {
url = "git://github.com/manoelcampos/xml2lua",
tag = "v1.5-2"
tag = "v1.6-2"
}
description = {
summary = "An XML Parser written entirely in Lua that works for Lua 5.1+",
Expand Down
Loading

0 comments on commit 6f3c0d5

Please sign in to comment.