[lxml-dev] Objectify and a text-tag

Christian Zagrodnick cz at gocept.com
Mon Feb 26 18:05:03 CET 2007


On 2007-02-26 15:27:41 +0100, Tres Seaver <tseaver at palladion.com> said:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Christian Zagrodnick wrote:
>> Hi
>> 
>> assuming i've got an XML like
>> 
>> <foo><text>blabla</text></foo>
>> 
>> How am I supposed to change the blabla text? foo.text does obviously 
>> not work since that is the text value of foo.
>> 
>> foo['text'] would have been nice, but that's not working either.
>> 
>> Any suggestions?
> 
> Maybe 'foo.find("text")'?

Well... that doesn't create the tag. The charm of foo.bar = 'baz' is 
that it creates the tag if it isn't there.


-- 
Christian Zagrodnick

gocept gmbh & co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891





More information about the lxml-dev mailing list