XML Parsing, memory problem with minidom

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
oliv Offline
Junior Member
Posts: 13
Joined: Mar 2007
Reputation: 0
Post: #1
Hello,

I have problem with the memory used by the parsing of an XML file using minidom. I cannot release the used memory, and my script doesn't work well.

I found cElementTree (http://effbot.org/zone/celementtree.htm), but we can't use it in XBMC... Does somebody know where to find a compiled library or if sombody can do it for me, I haven't a pc with windows... and XDK

Thanks
Oliv
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 959
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #2
I've had lots of memory issues with XML parsing myself and resorted to using regular expressions. waaaaay faster for hardly any mem usage. of course if the xml struct changes the regex breaks....

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
oliv Offline
Junior Member
Posts: 13
Joined: Mar 2007
Reputation: 0
Post: #3
Oh... I have spent some much time to convert my configuration file to xml and then all regex accessing method to real dom function.... No Sad

So thanks for the advice...
Oliv


PS: concerning myTV, could you include the french switzerland channels TSR 1 & 2, in a french category with the channels from france and belgium for example, it would be nice...?
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 959
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #4
I know XML is all the rage, but sometimes I think its a little to verbose for some situations.
eg. a config file that simply has key = value.

Which is why I chose to use the built in python ConfigParser, its simple to use and handles all read/writting etc.
Within the same file you can have multiple named Sections with its own key = value sets.
See mytv\system\config.dat for an example.

regarding myTV: The channels are dependant on what the datasource provides. Which datasource do you use or maybe theres a web site that could provide programme listings for channels you want ? (PM me or post in the mytv thread)
BBB

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
spiff Offline
Grumpy Bastard Developer
Posts: 12,174
Joined: Nov 2003
Reputation: 82
Post: #5
or get a sax parser.

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.
find quote
oliv Offline
Junior Member
Posts: 13
Joined: Mar 2007
Reputation: 0
Post: #6
Thanks for your responses, but I finally found a version of ElementTree that works fine on XBMC and that is able to load my big xml file.

The use of Element tree requires just a few modification with minidom, and is easier to use...

I recommend it... Wink

>> http://effbot.org/downloads/elementtree-...050316.zip
find quote