Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
5aa6adb6
Commit
5aa6adb6
authored
Dec 26, 2012
by
Mirsal Ennaime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upnp sd: work around missing XML namespaces in DIDL documents
parent
5725edf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
modules/services_discovery/upnp.cpp
modules/services_discovery/upnp.cpp
+34
-4
No files found.
modules/services_discovery/upnp.cpp
View file @
5aa6adb6
...
...
@@ -259,14 +259,44 @@ IXML_Document* parseBrowseResult( IXML_Document* p_doc )
{
assert
(
p_doc
);
const
char
*
psz_result_string
=
xml_getChildElementValue
(
p_doc
,
"Result"
);
/* Missing namespaces confuse the ixml parser. This is a very ugly
* hack but it is needeed until devices start sending valid XML.
*
* It works that way:
*
* The DIDL document is extracted from the Result tag, then wrapped into
* a valid XML header and a new root tag which contains missing namespace
* definitions so the ixml parser understands it.
*
* If you know of a better workaround, please oh please fix it */
const
char
*
psz_xml_result_fmt
=
"<?xml version=
\"
1.0
\"
?>"
"<Result xmlns:sec=
\"
urn:samsung:metadata:2009
\"
>%s</Result>"
;
char
*
psz_xml_result_string
=
NULL
;
const
char
*
psz_raw_didl
=
xml_getChildElementValue
(
p_doc
,
"Result"
);
if
(
!
psz_raw_didl
)
return
NULL
;
if
(
-
1
==
asprintf
(
&
psz_xml_result_string
,
psz_xml_result_fmt
,
psz_raw_didl
)
)
return
NULL
;
if
(
!
psz_result_string
)
IXML_Document
*
p_result_doc
=
ixmlParseBuffer
(
psz_xml_result_string
);
free
(
psz_xml_result_string
);
if
(
!
p_result_doc
)
return
NULL
;
IXML_Document
*
p_browse_doc
=
ixmlParseBuffer
(
psz_result_string
);
IXML_NodeList
*
p_elems
=
ixmlDocument_getElementsByTagName
(
p_result_doc
,
"DIDL-Lite"
);
IXML_Node
*
p_node
=
ixmlNodeList_item
(
p_elems
,
0
);
ixmlNodeList_free
(
p_elems
);
return
p_browse_doc
;
return
(
IXML_Document
*
)
p_node
;
}
/*
...
...
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