Any Kodi addon experts here ? xml parsing issue

0 chossy chossadopalis · August 1, 2015
Hi
i am trying to code a kodi plugin but have come unstuck trying to parse a string containing an & symbol in it.
My xml looks like this

    <channel name="BBC1">
        <url>plugin://plugin.video.F.T.V/?url=14&mode=125&name=BBC+One+%2814%29&iconimage=http%3A%2F%2Fstatic.filmon.com%2Fcouch%2Fchannels%2F14%2Fextra_big_logo.png&start=na&ch_fanart=na</url>
        <image>http://chossy.x10host.com/images/ukfree/BBC1.png</image>
    </channel>
        <channel name="BBC2">
        <url>http://vs-hds-uk-live.edgesuite.net/pool_5/live/bbc_two_hd/bbc_two_hd.isml/bbc_two_hd-audio_1%3D128000-video%3D3500000.m3u8</url>
        <image>http://chossy.x10host.com/images/ukfree/BBC2.png</image>
    </channel>

BBC2 parses fine its the BBC1 string it fails on.
I am using xml.etree.ElementTree and trying to read the string like this
myXml = ET.parse(xmlFile)
myXmlroot = myXml.getroot()    

for channel in myXmlroot.findall('channel'):
    name = channel.get('name')
    itemurl = channel.find('url').text
    logo = channel.find('image').text
    print(itemurl)

could someone please tell me how i can read the full string with out getting his error

Error Type: <class 'xml.etree.ElementTree.ParseError'>
Error Contents: not well-formed (invalid token): line 4, column 53

Many thanks

Chossy


Post a Reply

Replies

Oldest  Newest  Rating
0 chossy chossadopalis · August 1, 2015
Sorted Now
  • 1

Python

106,976 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator