Type attributes with E-factory
Hi, Sorry for the very basic question. I'm trying lxml for the first time, playing with the builder and I would like to know if it's possible to create type attributes in the top level? E.g: <domain *type='kvm' id='19'*> <name>mcontroller</name> <uuid>9b9e2237-fff5-4598-92ec-89603e4c300a</uuid> </domain> I can't figure out how to add " *type='kvm' id='19'*" to the *domain *above. Something like: controller = E.domain((type='kvm', id='19') E.name('mcontroller'), ... Thanks, ||Rich
Am 13. Januar 2017 17:45:45 MEZ schrieb Richard Wellum:
Sorry for the very basic question. I'm trying lxml for the first time, playing with the builder and I would like to know if it's possible to create type attributes in the top level?
E.g:
<domain *type='kvm' id='19'*> <name>mcontroller</name> <uuid>9b9e2237-fff5-4598-92ec-89603e4c300a</uuid> </domain>
I can't figure out how to add " *type='kvm' id='19'*" to the *domain *above.
Something like:
controller = E.domain((type='kvm', id='19') E.name('mcontroller'), ...
In Python, keyword arguments (attributes) always appear behind positional arguments (tags), i.e. pass the name first, then type and id. Stefan
All - thanks very much! Code is up and working and I like this lxml etree very much. ||Rich On Sat, Jan 14, 2017 at 7:48 AM Stefan Behnel <stefan_ml@behnel.de> wrote:
Am 13. Januar 2017 17:45:45 MEZ schrieb Richard Wellum:
Sorry for the very basic question. I'm trying lxml for the first time, playing with the builder and I would like to know if it's possible to create type attributes in the top level?
E.g:
<domain *type='kvm' id='19'*> <name>mcontroller</name> <uuid>9b9e2237-fff5-4598-92ec-89603e4c300a</uuid> </domain>
I can't figure out how to add " *type='kvm' id='19'*" to the *domain *above.
Something like:
controller = E.domain((type='kvm', id='19') E.name('mcontroller'), ...
In Python, keyword arguments (attributes) always appear behind positional arguments (tags), i.e. pass the name first, then type and id.
Stefan _________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml
participants (2)
-
Richard Wellum
-
Stefan Behnel