-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Trying to parse the below xml - there are embedded xml elements as some of the values. Those embedded xml values are randomly encoded or decoded - sometimes partially encoded/decoded when you retrieve values... Running in ten times leads to ten different combinations of some entities decoded or encoded in the values almost unpredictably..
xmlres.root['e:propertyset']['e:property']['LastChange'] is being accessed.
The result should be an xml string. That xml string happens to have further encoded xml in some of its attributes. Those attributes are sometimes fully decoded (making the xml invalid) or sometimes partially decoded (still invalid).. What is worse, is that it is completely unpredictable what comes out..
abovexmlparsed['Event']['InstanceID']['CurrentTrackMetadata']['_attr']['val'] - should be accessible and valid xml.
xml2lua
1.5-2 (installed) - /opt/homebrew/lib/luarocks/rocks-5.4
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio on MacOS M1-Pro arm64
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0"><e:property><Event xmlns="urn:schemas-upnp-org:metadata-1-0/AVT/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/"><InstanceID val="0"><TransportState val="PLAYING"/><CurrentPlayMode val="NORMAL"/><CurrentCrossfadeMode val="0"/><NumberOfTracks val="1"/><CurrentTrack val="1"/><CurrentSection val="0"/><CurrentTrackURI val="x-sonos-htastream:RINCON_XXXXXXXX01400:spdif"/><CurrentTrackDuration val=""/><CurrentTrackMetaData val="<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/&quot; xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1" restricted="true"><res protocolInfo="x-sonos-htastream:::*">x-sonos-htastream:RINCON_XXXXXXX01400:spdif</res><r:audioInputIcon></r:audioInputIcon><r:streamInfo>21</r:streamInfo><dc:title> </dc:title><upnp:class>object.item</upnp:class><r:episodeNumber>0</r:episodeNumber></item></DIDL-Lite>"/><r:NextTrackURI val=""/><r:NextTrackMetaData val=""/><r:EnqueuedTransportURI val=""/><r:EnqueuedTransportURIMetaData val=""/><PlaybackStorageMedium val="NETWORK"/><AVTransportURI val="x-sonos-htastream:RINCON_XXXXXXXXX01400:spdif"/><AVTransportURIMetaData val="<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/&quot; xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="spdif-input" parentID="0"restricted="false"><dc:title>RINCON_949F3E67640701400</dc:title><upnp:class>object.item.audioItem.linein.homeTheater</upnp:class><res protocolInfo="spdif">x-sonos-htastream:RINCON_XXXXXXXX01400:spdif</res></item></DIDL-Lite>"/><CurrentTransportActions val="Set, Play"/><r:CurrentValidPlayModes val=""/></InstanceID></Event></e:property></e:propertyset>