summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua
index f3ebb0445e8..4da0edc43bb 100644
--- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua
+++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua
@@ -1,4 +1,4 @@
-module(...,package.seeall)
+-- module(...,package.seeall)
---
-- Overview:
-- =========
@@ -162,7 +162,8 @@ local format= string.format
---Parses a XML string
--@param handler Handler object to be used to convert the XML string
--to another formats. @see handler.lua
-xmlParser = function(handler)
+local M={}
+local xmlParser = function(handler)
local obj = {}
-- Public attributes
@@ -192,7 +193,7 @@ xmlParser = function(handler)
if not match then
if string.find(str,self._WS,pos) then
-- No more text - check document complete
- if table.getn(self._stack) ~= 0 then
+ if #self._stack ~= 0 then
self:_err(self._errstr.incompleteXmlErr,pos)
else
break
@@ -477,15 +478,17 @@ xmlParser = function(handler)
return obj
end
+M.xmlParser = xmlParser
-function xmlEscape(s)
+local function xmlEscape(s)
local t = {['"']="&quot;",["'"]="&apos;",["&"]="&amp;",["<"]="&lt;",[">"]="&gt;"}
return string.gsub(s,"([\"'<>&])",t)
end
+M.xmlEscape = xmlEscape
-function serialize(tb)
+local function serialize(tb)
local function getAttributes(k,v)
local i = ""
if(type(v["_attr"])=="table") then
@@ -496,8 +499,9 @@ local function getAttributes(k,v)
--table.remove(v,"_attr")
end
return i
-end
- local function printable(tb, level,currTag)
+ end
+
+ local function printable(tb, level,currTag)
local r ={}
local currTag = currTag or ""
level = level or 0
@@ -545,3 +549,5 @@ end
end
return table.concat({'<?xml version="1.0" encoding="UTF-8"?>',printable(tb)},"\n")
end
+M.serialize = serialize
+return M