Those instances of xmlns="" mean that those elements are not in any namespace. In your original string they are in the default namespace, but something has changed in your processing which caused that namespace information to be lost, correct?
So that must be your DOM parser's fault. And that happens because DOM parsers are not namespace-aware by default. (Not a very good default, but that's how it is.) Check out the setNamespaceAware() method of DocumentBuilderFactory and use it in your code.
(By the way, is there a reason you did this XML processing instead of just writing the string directly to the file?)
And, welcome to the Ranch!
Joined: Jun 05, 2014
Thanks for quick reply.
Let me me check this method.
subject: Blank xmlns added as attributes when converting from String to XML using Java