How can I change the namespace on every node in a DOM?

前端 未结 8 681
小蘑菇
小蘑菇 2020-12-19 10:05

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

8条回答
  •  一整个雨季
    2020-12-19 10:55

    Based on my hugely biased opinion what you want will be a huge pain in the ass. I can see the typecasting hell and numerous recursive for loops needed to do this reliably already! Ahh, Java's default implementation, how I hate your NPE:s at internals, the reversed logic, the extra steps needed for simple operations!

    So yes, my suggestion would be recursive for loops with typecasting for every single possible node type, based on my very personal experience the Java's default implementation sucks that badly.

提交回复
热议问题