How can I add two or more namespace on root element in a XML Document?
In Java, I create the XMLNode with two namespace and then I set it as root element in a XML Document.
In Salesforce, I have just read the documentation and it isn't available a constructor for the XMLNode.
So, I must create directly a root element from a Dom.Document object and I can set only a namespace.
I don't find a solution.
Thanks a lot!
Best Answer
You can set as many namespaces as you'd like with setNamespace. Here's a trivial execute anonymous script:
Output (note: This is cleaned up for legibility):
Observe how root now has three namespaces, the default namespace, plus "a" and "b" namespaces.