[lxml-dev] annotate, pyannotate, xsiannotate

jholg at gmx.de jholg at gmx.de
Tue Sep 18 09:21:07 CEST 2007


Hello Stefan,

> > attribute. That's the main reason I propose the keep_tree functionality,
> to
> > make ObjectifiedElement-leaves survive a creation-serialization-parse
> > cycle.
> 
> I think we should do this:
> 
>                 if old_pytypename == TREE_PYTYPE:
>                     if cetree.findChild(c_node, 0) is NULL:
>                         pytype = TREE_PYTYPE
>                 else:
>                     # check old type
> 
> Do you still think we need the keep_tree then?

You really don't like it, do you ;-)?
I'd say this should work and remove the need for keep_tree, though.

Sidenote: So I thought maybe we should revise the use of TREE in objectify in general, but one has to be very careful. You really want to have it e.g. in objectify.Element():

>>> o = objectify.Element("structural")
>>> e = etree.Element("structural") 
>>> type(o), type(e)
(<type 'objectify.ObjectifiedElement'>, <type 'objectify.ObjectifiedElement'>)
>>> root.o = o
>>> root.e = e
>>> # Now type lookup can not rely on parent == None
... 
>>> type(root.o), type(root.e)
(<type 'objectify.ObjectifiedElement'>, <type 'objectify.StringElement'>)
>>> 

Holger
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger


More information about the lxml-dev mailing list