Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
92432ec2
Commit
92432ec2
authored
Jan 22, 2011
by
Jean-Philippe André
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lua: fix module simplexml using the new API
parent
06fb88fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
share/lua/modules/simplexml.lua
share/lua/modules/simplexml.lua
+9
-10
No files found.
share/lua/modules/simplexml.lua
View file @
92432ec2
...
@@ -36,16 +36,15 @@ local function parsexml(stream, errormsg)
...
@@ -36,16 +36,15 @@ local function parsexml(stream, errormsg)
local
tree
local
tree
local
parents
=
{}
local
parents
=
{}
local
nodetype
=
reader
:
next_node
()
local
nodetype
,
nodename
=
reader
:
next_node
()
while
nodetype
>
0
do
while
nodetype
>
0
do
--print(nodetype, reader:name())
if
nodetype
==
1
then
if
nodetype
==
1
then
local
n
ame
=
reader
:
name
()
local
n
ode
=
{
name
=
nodename
,
attributes
=
{},
children
=
{}
}
local
node
=
{
name
=
''
,
attributes
=
{},
children
=
{}
}
local
attr
=
reader
:
next_attr
()
node
.
name
=
name
while
attr
~=
nil
do
while
reader
:
next_attr
()
==
0
do
node
.
attributes
[
attr
]
=
reader
:
value
()
node
.
attributes
[
reader
:
name
()]
=
reader
:
value
()
attr
=
reader
:
next_attr
()
end
end
if
tree
then
if
tree
then
table.insert
(
tree
.
children
,
node
)
table.insert
(
tree
.
children
,
node
)
...
@@ -54,10 +53,8 @@ local function parsexml(stream, errormsg)
...
@@ -54,10 +53,8 @@ local function parsexml(stream, errormsg)
tree
=
node
tree
=
node
elseif
nodetype
==
2
then
elseif
nodetype
==
2
then
if
#
parents
>
0
then
if
#
parents
>
0
then
local
name
=
reader
:
name
()
local
tmp
=
{}
local
tmp
=
{}
--print(name, tree.name, #parents)
while
nodename
~=
tree
.
name
do
while
name
~=
tree
.
name
do
if
#
parents
==
0
then
if
#
parents
==
0
then
error
(
"XML parser error/faulty logic"
)
error
(
"XML parser error/faulty logic"
)
end
end
...
@@ -80,6 +77,7 @@ local function parsexml(stream, errormsg)
...
@@ -80,6 +77,7 @@ local function parsexml(stream, errormsg)
elseif
nodetype
==
3
then
elseif
nodetype
==
3
then
table.insert
(
tree
.
children
,
reader
:
value
())
table.insert
(
tree
.
children
,
reader
:
value
())
end
end
nodetype
,
nodename
=
reader
:
next_node
()
end
end
if
#
parents
>
0
then
if
#
parents
>
0
then
...
@@ -108,3 +106,4 @@ function add_name_maps(tree)
...
@@ -108,3 +106,4 @@ function add_name_maps(tree)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment