Message277130
In the example there are two namespaces in one document, but it is impossible to search all elements only in one namespace:
>>> import xml.etree.ElementTree as etree
>>>
>>> s = '<feed xmlns="http://def" xmlns:x="http://x"><a/><x:b/></feed>'
>>>
>>> root = etree.fromstring(s)
>>>
>>> root.findall('*')
[<Element '{http://def}a' at 0xb73961bc>, <Element '{http://x}b' at 0xb7396c34>]
>>>
>>> root.findall('{http://def}*')
[]
>>>
And same try with site package lxml works fine:
>>> import lxml.etree as etree
>>>
>>> s = '<feed xmlns="http://def" xmlns:x="http://x"><a/><x:b/></feed>'
>>>
>>> root = etree.fromstring(s)
>>>
>>> root.findall('*')
[<Element {http://def}a at 0xb70ab11c>, <Element {http://x}b at 0xb70ab144>]
>>>
>>> root.findall('{http://def}*')
[<Element {http://def}a at 0xb70ab11c>]
>>> |
|
Date |
User |
Action |
Args |
2016-09-21 12:38:13 | py.user | set | recipients:
+ py.user |
2016-09-21 12:38:12 | py.user | set | messageid: <1474461492.99.0.941056742104.issue28238@psf.upfronthosting.co.za> |
2016-09-21 12:38:12 | py.user | link | issue28238 messages |
2016-09-21 12:38:12 | py.user | create | |
|