[lxml-dev] iterparse and namespaces
jholg at gmx.de
jholg at gmx.de
Tue Mar 17 15:23:55 CET 2009
Hi,
> > Is that possible to get all tags "a" without passing namespace? I mean,
> a2
> > works, but could it be possible to make a1 working too?
>
> ..., tag="{*}a"
>
> might work.
I thought so too but it doesn't :)
>>> for e in etree.iterparse(StringIO(xml), tag="{*}a"): print e
...
The wildcard works for element names, not for namespaces:
>>> for e in etree.iterparse(StringIO(xml), tag="{http://www.example.com}*"): print e
...
(u'end', <Element {http://www.example.com}a at 2d7510>)
(u'end', <Element {http://www.example.com}a at 2d7570>)
(u'end', <Element {http://www.example.com}root at 2675a0>)
>>>
Same holds for .iter().
Is there a usecase for "give me every element x from whatever namespace"?
Holger
--
Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal geschützt?
Jetzt informieren und absichern: https://homebanking.web.de/?mc=mail@footer.
More information about the lxml-dev
mailing list