ElementTree ; change namespace

  • Thread starter Benjamin Watine
  • Start date
B

Benjamin Watine

Hello the list,

I have question about ElementTree module, I didn't find a specific list
so I post here. I hope I'm not wrong.

I would like to know how to change the namespace URI of all the Element
of my XML tree without changing anything else.

I want that because I have to compare 2 XML trees, so I walk trought the
first tree, and each time I found an element, I delete it (with the
Element.remove() function) on the second tree. This way, I can see if
there is remaining or lacking elements in my second tree.
The problem is that my two trees may not have the same namespace, so the
Element.remove() function doesn't work. That's why I want to change the
namespace.

Also, The Element.remove() documentation says it compares element with
their identity ; what is exactly an element identity ?

Thank you,

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,730
Latest member
AudryNolan

Latest Threads

Top