createElementNS adds empty XMLNS to lower tags

Hi im working on sending a soap message

I get the soap message part made but have to add in a default namespace to one of the tags, so I create a new elementNS add the child node of the tag it will replace and then do replacechild to swap the old node with the new node that has the xmlns.

I then add another node within that node.

SOAPBody body = soapMessage.getSOAPBody();

Node soapXML = body.getFirstChild().getFirstChild();

String nodeName = body.getFirstChild().getNodeName();

Element actionElement = soapMessage.getSOAPPart().createElementNS("http://Dealogic.com/DAAPI", nodeName);

actionElement.appendChild(soapXML);

body.replaceChild(actionElement, body.getFirstChild());

SOAPElement sSKIDNode = (SOAPElement)soapMessage.getSOAPPart().createElementNS(null, DEALAXIS_SSKID);

sSKIDNode.addTextNode(sSKID);

((SOAPElement)body.getFirstChild()).addChildElement(sSKIDNode);

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<InvestorUpload xmlns="http://Dealogic.com/DAAPI">

<xmlInvestor xmlns="">

<INVESTOR></INVESTOR>

</xmlInvestor>

<sSKID xmlns=""></sSKID>

</InvestorUpload>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

before the swap the xmlInvestor and sSKID tags do not havd xmlns but after they have the xmlns="" that you can see. these later present a problem when sending to the web service.

Is there a way in that i can stp this happening

chers

[1649 byte] By [Liam_Morrena] at [2007-11-26 13:15:47]
# 1

<xmlInvestor xmlns="">

So you want that element to be in the "http://Dealogic.com/DAAPI" namespace? Then you must say so when you create it, by calling the right method. It appears that you are copying it from a node that is not in any namespace, and the result is what you see: it is not in any namespace.

DrClapa at 2007-7-7 17:36:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...