[vlc-devel] commit: Add function to add a children map to an xml table. (children_map[ tagname] is an array of all the child tags with give name) ( 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:39:52 2010 +0100| [f55a3a4bbcbb49ba5788923316c30aea2966328a] | committer: Antoine Cellerier
Add function to add a children map to an xml table. (children_map[tagname] is an array of all the child tags with give name)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f55a3a4bbcbb49ba5788923316c30aea2966328a
---
share/lua/modules/simplexml.lua | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/share/lua/modules/simplexml.lua b/share/lua/modules/simplexml.lua
index 5d0d60f..bda68a4 100644
--- a/share/lua/modules/simplexml.lua
+++ b/share/lua/modules/simplexml.lua
@@ -93,3 +93,16 @@ end
function parse_string(str)
return parsexml(vlc.memory_stream(str))
end
+
+function add_name_maps(tree)
+ tree.children_map = {}
+ for _, node in pairs(tree.children) do
+ if type(node) == "table" then
+ if not tree.children_map[node.name] then
+ tree.children_map[node.name] = {}
+ end
+ table.insert(tree.children_map[node.name], node)
+ add_name_maps(node)
+ end
+ end
+end
More information about the vlc-devel
mailing list