How can I, given a w3c DOM (Java\'s default implementation, specifically) change the namespace of every element/attribute/node in that DOM? Efficiently, preferably. The DO
You may copy your DOM tree to another tree and make some tweaks during process. For example, using org.apache.xml.utils.DOMBuilder as the implementation of ContentHandler, you may override methods in such way:
public void startElement(String ns, String localName, String name, Attributes atts) throws SAXException {
super.startElement("new_namespace", localName, name, atts);
}
DOMBuilder will handle all dirty work during copying leaving to you only namespace replacement logic.