@karvjorm,Using this method is not exactly a good practice. Infact, I think it may be a bug.Names beginning with "xml" are reserved (for namespaces in this case).setAttribute() should return false in this case I think, but I suppose it doesn't.

Still, the right way to do it is with createElementNS().It lets you specify the namespace when creating the element node.