xml.dom.minidom
#1
i'm trying to make a python script that parses an xml file. i implemented it using xml.dom.minidom and it works great when i run it on my pc using xbmc emulator. when i try to run the script on my xbox it doesn't start. here is a clip of my script...

Quote: def parserss(self, url):
opener = urllib.fancyurlopener({})
f = opener.open(url)
xmldata = f.read()
dom = xml.dom.minidom.parsestring(xmldata)
self.updateitemlist(dom)

def updateitemlist(self, dom):
items = dom.getelementsbytagname("title")
for item in items:
self.itemlist.additem(self.gettext(item.childnodes))

def gettext(self, nodelist):
rc = ""
for node in nodelist:
if node.nodetype == node.text_node:
rc = rc + node.data
return rc

is is so that i can't use dom in xbmc or is there something wrong with the code? (this is the first thing i'm coding with python)...
Reply
#2
which error does python give you? ( can be found in the log file)
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
(darkie @ sep. 16 2004,16:11 Wrote:which error does python give you? ( can be found in the log file)
thanks for the quick reply...

heh.. why didn't i look there at the first place. :nuts: got my script working already.. so this thread is totally useless. Smile
Reply
#4
hi all !
i wish to use this parser as well but don't know at all how tomake it work... can someone help me please ?
Reply
#5
(solexalex @ sep. 17 2004,00:26 Wrote:hi all !
i wish to use this parser as well but don't know at all how tomake it work... can someone help me please ?
here is one example... not the clearest one, but i hope you can get something out of it http://www.python.org/doc/2.3.4/lib/dom-example.html

here is also a link to the python xml.dom api http://www.python.org/doc/2.3.4/lib/module-xml.dom.html

also that small example above that i posted... it takes all <title> -elements and puts them in a controllist.

i hope this helps you to get started...
Reply
#6
Quote:i hope this helps you to get started...
sure it will !!
thanks a lot !
Reply
#7
hey
i was lokking at your code and i saw that you did not closed your f file !!
f.close()

i think it could be the reason !
see ya
Reply

Logout Mark Read Team Forum Stats Members Help
xml.dom.minidom0