Creating an XML document using namespaces in Java
I am looking for example Java code that can construct an XML document that uses namespaces. I cannot seem to find anything using my normal favourite tool so was hoping someone may be able to help me out. I am not sure, what you trying to do, but I use jdom for most of my xml-issues and it supports namespaces (of course). The code: Document doc = new Document(); Namespace sNS = Namespace.getNamespace("someNS", "someNamespace"); Element element = new Element("SomeElement", sNS); element.setAttribute("someKey", "someValue", Namespace.getNamespace("someONS", "someOtherNamespace")); Element