[vlc-devel] [PATCH 2/3] lua: Allow plain tables to be serialized to xml
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Wed May 27 11:22:56 CEST 2020
Otherwise the resulting key is just a number, which is invalid XML
---
share/lua/intf/modules/httprequests.lua | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index ef7ee2fca5..33f2836a00 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -238,7 +238,11 @@ local printXmlKeyValue = function (k,v,indent)
print("\n")
for i=1,indent do print(" ") end
if (k) then
- print("<"..k..">")
+ if not tonumber(k) then
+ print("<"..k..">")
+ else
+ print("<entry_"..k..">")
+ end
end
if (type(v)=="table") then
@@ -251,10 +255,12 @@ local printXmlKeyValue = function (k,v,indent)
xs=xmlString(k)
space_loc=string.find(xs," ")
if space_loc == nil then
- print("</"..xs..">")
- else
xs=string.sub(xs,1,space_loc)
+ end
+ if not tonumber(xs) then
print("</"..xs..">")
+ else
+ print("</entry_"..xs..">")
end
end
end
--
2.20.1
More information about the vlc-devel
mailing list