
Nov. 24, 2009
11:40 a.m.
Hi, I'm new of lxml and XML programming. I would to use etree as a hierarchical object tree: every node element should have a property associated to an object.
import lxml.etree as etree element=etree.fromstring('<TAG>some text</TAG>') element.text="a string"
that's all ok, but:
element.text={'a':'real', 'python':'object'} TypeError: Argument must be string or unicode.
OK, the property name is "text" so some text is expected! My question is: if write a custom element with a property called "object", may I store inside it a reference to an object?