I'm trying to define multiple namespaces in an XML element. No matter what I do, it only adds one. Even if I have the code like so:
Element usernameToken = doc.createElement("wsse:UsernameToken"); usernameToken.setAttribute("xmlns:wsu","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); usernameToken.setAttribute("xmlns:wsse","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); usernameToken.setAttribute("wsu:Id",uuid()); security.appendChild(usernameToken); The output doesn't define the wsse namespace:
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="d06c6404-1e3c-478f-b998-5757ffe8996f"/> Help? The wsse namespace is defined in another element further up the hierarchy, but I need it defined in both. Don't ask me why.
No comments:
Post a Comment