axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "tom ONeill" <beagleboythefi...@hotmail.com>
Subject Namespace declaration location
Date Mon, 28 Feb 2005 09:05:15 GMT
Hi all,

I have been unable to get an answer to this question on the user list and 
all my testing has failed to resolve the issue so with a deadline fast 
approaching Im taking a last chance at posting on this list...

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 know what to wear tomorrow? Get an accurate weather forecast at MSN 
Weather! http://www.msn.ie/weather


Mime
View raw message