elementtree.ElementTree
の名前のXML名前空間を無視する方法はありますか?Python:elementtree.ElementTreeのxmlnsを無視する
私はすべてのtechnicalContact
タグ印刷しよう:
for item in root.getiterator(tag='{http://www.example.com}technicalContact'):
print item.tag, item.text
をそして私のようなものを得る:
{http://www.example.com}technicalContact [email protected]
をしかし、私が本当にしたいことは次のとおりです。
technicalContact [email protected]
は、方法はありますサフィックス(sans xmlns)のみを表示するか、明示的にxmlnsを記述しなくても要素を繰り返し処理することができますか?
多くのためhttp://stackoverflow.com/a/25920989/2593383下私の答えを参照してください。一般的な解決策 – nonagon