On 1/28/11, Stefan Behnel wrote:
> Alex Hall, 28.01.2011 14:25:
>> On 1/28/11, Stefan Behnel wrote:
>>> Alex Hall, 28.01.2011 14:09:
On 1/28/11, Stefan Behnel wrote:
> Alex Hall, 27.01.2011 23:23:
>> self.id=root.find("id").text
>> self.name=root.find("name).text
>
> T
Alex Hall, 28.01.2011 14:25:
On 1/28/11, Stefan Behnel wrote:
Alex Hall, 28.01.2011 14:09:
On 1/28/11, Stefan Behnel wrote:
Alex Hall, 27.01.2011 23:23:
self.id=root.find("id").text
self.name=root.find("name).text
There's a findtext() method on Elements for this purpose.
I thought tha
On 1/28/11, Stefan Behnel wrote:
> Alex Hall, 28.01.2011 14:09:
>> On 1/28/11, Stefan Behnel wrote:
>>> Alex Hall, 27.01.2011 23:23:
self.id=root.find("id").text
self.name=root.find("name).text
>>>
>>> There's a findtext() method on Elements for this purpose.
>>>
>> I thought that was
Alex Hall, 28.01.2011 14:09:
On 1/28/11, Stefan Behnel wrote:
Alex Hall, 27.01.2011 23:23:
self.id=root.find("id").text
self.name=root.find("name).text
There's a findtext() method on Elements for this purpose.
I thought that was used to search for the text of an element? I want
to get th
On 1/28/11, Stefan Behnel wrote:
> Hi,
>
> since you said that you have it working already, here are just a few
> comments on your code.
>
> Alex Hall, 27.01.2011 23:23:
>> all=root.findall("list/result")
>> for i in all:
>> self.mylist.append(Obj().parse(i))
>
> It's uncommon to use "i" for any
Hi,
since you said that you have it working already, here are just a few
comments on your code.
Alex Hall, 27.01.2011 23:23:
all=root.findall("list/result")
for i in all:
self.mylist.append(Obj().parse(i))
It's uncommon to use "i" for anything but integer loop variables. And 'all'
is not
Thanks, I think I have it working.
On 1/27/11, Karim wrote:
>
> id is a tag so it is a OBJECT Element with attributes accessible by
> dictionnary x.attrib[key] and x.text for tag content text.
>
> canonical string representation of your Element object: Obj.id :> 'result' at [mem addr]
> And roo
id is a tag so it is a OBJECT Element with attributes accessible by
dictionnary x.attrib[key] and x.text for tag content text.
canonical string representation of your Element object: Obj.id :>composite
pattern.
For result use iterator as below (not tested but should be ok):
*_/#Parsing:/
Hi all,
I am using, and very much enjoying, the ElementTree library. However,
I have hit a problem. Say I have something along the lines of:
Message from Service
1.0
1
result 1
2
result 2
In my ResultSet class, I parse this to get the text of elements like
message or