Hi all,

I have some custom written code that I am using to serialize Java objects into XML using the Axis API. Specifically I am using the SerializationContextImpl classes serialize method.

I am wondering if there is any way of changing the location of the namespace declarations within the resulting XML. As an example the result of serializing one of my objects give me the following XML:

<ns1:Booking xsi:type="ns1:Booking" xmlns:ns1="http://www.joebloggs.com/package/com.joebloggs/"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<Name xsi:nil="true"/>
<sessionID>930817318</sessionID>
<loginSuccessful>true</loginSuccessful>
<Reference xsi:type="ns2:Reference" xmlns:ns2="http://www.joebloggs.com/package/com.joebloggs.reference/";>
<RefNum>101</RefNum>
</Reference>
</ns1:Booking>



What I am looking for is the Reference namespace declaration to be included in the root element so that the results XML is as follows:


<ns1:Booking xsi:type="ns1:Booking" xmlns:ns1="http://www.joebloggs.com/package/com.joebloggs/";
xmlns:ns2="http://www.joebloggs.com/package/com.joebloggs.reference/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<Name xsi:nil="true"/>
<sessionID>930817318</sessionID>
<loginSuccessful>true</loginSuccessful>
<Reference xsi:type="ns2:Reference" >
<RefNum>101</RefNum>
</Reference>
</ns1:Booking>


Is there anyway to define where you want the namespace declarations to be included?

Cheers,
Tom

_________________________________________________________________
Don�t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/




Reply via email to