Re: converting XML to hash/dict/CustomTreeCtrl

2010-02-03 Thread Nobody
On Wed, 03 Feb 2010 08:07:50 +1100, Astan Chee wrote: Sorry for being vague but here my question about converting an xml into a dict. I found some examples online but none gives the dict/result I want. Which is kinda wrong. I expect the dict to have the Space usage summary, but it

Re: converting XML to hash/dict/CustomTreeCtrl

2010-02-03 Thread Astan Chee
Nobody wrote: The code you're using expects the XML to follow a particular format, and yours doesn't. You might want to start with a fairly direct translation, e.g.: def xmldict(e): d = {} d['tag'] = e.tag d.update(e.attrib) children = map(xmldict, e) if children:

Re: converting XML to hash/dict/CustomTreeCtrl

2010-02-02 Thread Astan Chee
Hi, Sorry for being vague but here my question about converting an xml into a dict. I found some examples online but none gives the dict/result I want. The xml looks like this: doc stats name=position1 description=Calculation statistics kind=position stats name=time description=Timing

Re: converting XML to hash/dict/CustomTreeCtrl

2010-02-01 Thread Stefan Behnel
Astan Chee, 01.02.2010 23:34: I have xml files that I want to convert to a hash/dict and then further placed in a wx CustomTreeCtrl based on the structure. The problem I am having now is that the XML file is very unusual and there aren't any unique identifiers to be put in a dict and because