Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
c6285698
Commit
c6285698
authored
Feb 14, 2010
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix simplexml (still has issues with <bla/> tags)
parent
43848e7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
share/lua/intf/modules/common.lua
share/lua/intf/modules/common.lua
+4
-0
share/lua/modules/simplexml.lua
share/lua/modules/simplexml.lua
+15
-8
No files found.
share/lua/intf/modules/common.lua
View file @
c6285698
...
...
@@ -54,6 +54,10 @@ end
-- print a table (recursively)
function
table_print
(
t
,
prefix
)
local
prefix
=
prefix
or
""
if
not
t
then
print
(
prefix
..
"/!\\ nil"
)
return
end
for
a
,
b
in
pairs_sorted
(
t
)
do
print
(
prefix
..
tostring
(
a
),
b
)
if
type
(
b
)
==
type
({})
then
...
...
share/lua/modules/simplexml.lua
View file @
c6285698
...
...
@@ -37,25 +37,32 @@ local function parsexml(stream)
local
parents
=
{}
while
reader
:
read
()
>
0
do
local
nodetype
=
reader
:
node_type
()
--print(nodetype, reader:name())
if
nodetype
==
'startelem'
then
local
name
=
reader
:
name
()
local
node
=
{
name
:
''
,
attributes
:
{},
children
:
{}
}
local
node
=
{
name
=
''
,
attributes
=
{},
children
=
{}
}
node
.
name
=
name
while
reader
:
NextA
ttr
()
==
0
do
node
.
attributes
[
reader
:
Name
()]
=
reader
:
V
alue
()
while
reader
:
next_a
ttr
()
==
0
do
node
.
attributes
[
reader
:
name
()]
=
reader
:
v
alue
()
end
if
tree
then
tree
.
children
[
#
tree
.
children
]
=
node
parents
[
#
parents
]
=
tree
tree
=
node
table.insert
(
tree
.
children
,
node
)
table.insert
(
parents
,
tree
)
end
tree
=
node
elseif
nodetype
==
'endelem'
then
tree
=
parents
[
#
parents
-
1
]
if
#
parents
>
0
then
tree
=
parents
[
#
parents
]
table.remove
(
parents
)
end
elseif
nodetype
==
'text'
then
node
.
children
[
#
node
.
children
]
=
reader
:
Value
(
)
table.insert
(
tree
.
children
,
reader
:
value
()
)
end
end
if
#
parents
>
0
then
error
(
"XML parser error/Missing closing tags"
)
end
return
tree
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