[vlc-devel] commit: This should fix <tag/> cases. (Antoine Cellerier )

git version control git at videolan.org
Mon Feb 15 00:38:43 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Mon Feb 15 00:31:29 2010 +0100| [8a00b3f2e5e04e97d45fafa7e4fdba19f3f85896] | committer: Antoine Cellerier 

This should fix <tag/> cases.

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

 share/lua/modules/simplexml.lua |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/share/lua/modules/simplexml.lua b/share/lua/modules/simplexml.lua
index e2f6b1f..5d0d60f 100644
--- a/share/lua/modules/simplexml.lua
+++ b/share/lua/modules/simplexml.lua
@@ -52,6 +52,26 @@ local function parsexml(stream)
             tree = node
         elseif nodetype == 'endelem' then
             if #parents > 0 then
+                local name = reader:name()
+                local tmp = {}
+                --print(name, tree.name, #parents)
+                while name ~= tree.name do
+                    if #parents == 0 then
+                        error("XML parser error/faulty logic")
+                    end
+                    local child = tree
+                    tree = parents[#parents]
+                    table.remove(parents)
+                    table.remove(tree.children)
+                    table.insert(tmp, 1, child)
+                    for i, node in pairs(child.children) do
+                        table.insert(tmp, i+1, node)
+                    end
+                    child.children = {}
+                end
+                for _, node in pairs(tmp) do
+                    table.insert(tree.children, node)
+                end
                 tree = parents[#parents]
                 table.remove(parents)
             end




More information about the vlc-devel mailing list