Вот разметка xml
<p:transition spd="slow"> <p:push dir="u"/> </p:transition>
Вот мой код:
namespaces = { 'p': 'http://schemas.openxmlformats.org/presentationml/2006/main' } transitions = et.findall('p:transition', namespaces) if transitions: # Only worry about the first node for now for p in transitions[0].iter(): print p.tag, p.text
Вывод на печать
{http://schemas.openxmlformats.org/presentationml/2006/main}transition {http://schemas.openxmlformats.org/presentationml/2006/main}push None
Я бы хотел пропустить узел p:transition. Как я могу сказать, p:transition является родительским узлом p:push?
p:transition
p:push
Кроме того, есть ли возможность убрать префикс расширенного пространства имен из распечатки тега: {http://schemas.openxmlformats.org/presentationml/2006/main} (или в этом случае p:push в порядке)
{http://schemas.openxmlformats.org/presentationml/2006/main}