如何访问XML树的根元素中的多个xmlns
声明?例如:
import xml.etree.cElementTree as ET
data = """<root
xmlns:one="http://www.first.uri/here/"
xmlns:two="http://www.second.uri/here/">
...all other child elements here...
</root>"""
tree = ET.fromstring(data)
# I don't know what to do here afterwards
我希望能获取类似于这个的字典,或者至少有一些格式可以更轻松地获取URI和匹配标签。
{'one':"http://www.first.uri/here/", 'two':"http://www.second.uri/here/"}