[vlc-commits] lua: Allow plain tables to be serialized to xml

Hugo Beauzée-Luyssen git at videolan.org
Fri May 29 13:12:27 CEST 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon May 25 15:17:27 2020 +0200| [93cd14bcfdcd5787ec2b5a5edb51a6bf7e1f5cd2] | committer: Hugo Beauzée-Luyssen

lua: Allow plain tables to be serialized to xml

Otherwise the resulting key is just a number, which is invalid XML

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=93cd14bcfdcd5787ec2b5a5edb51a6bf7e1f5cd2
---

 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



More information about the vlc-commits mailing list