[lxml-dev] [objectify] Typed E-factory for objectify, PT DataElement()-wrapper
jholg at gmx.de
jholg at gmx.de
Thu Jul 26 14:38:58 CEST 2007
Hi,
> I'm not all together happy with the attribute type business today, as it
> keeps
> people from generating 'clean' XML. Ok, you can run deannotate() on trees
> before you serialise, but that might mean that objectify could behave
> differently the next time you parse it. So it's somewhat quirky either
> way:
> live with the artifacts or live with surprises. Sounds like the first is a
> lot
> better, though. :)
If we make the behaviour I proposed switchable, then maybe this switch should also affect the auto-generation of py:pytype="TREE" in the objectify.Element() factory. That way the user can decide what you suggested:
-no artefacts, build up clean XML, at the cost of type-"uncertainty"
-with artefacts, you get py:pytype attributes everywhere and can rely on "stable types"
So one could basically use the objectify API in 2 ways, one being more or less an (arguably simpler) alternative to the etree API (if you need "clean" trees and are prepared to protect yourself against type confusion), the other being "fully type-annotated".
I think objectify.Element() is the only place where "TREE" gets auto-generated.
Holger
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
More information about the lxml-dev
mailing list