users@jax-rpc.java.net

serializing SOAPElement

From: Sels Wannes <Wannes.Sels_at_cronos.be>
Date: Mon, 17 Jan 2005 13:03:54 +0100

Hi,

 

I'm having a 'problem' serializing a SOAPElement. I have an any in my
wsdl which is mapped to a SOAPElement. I copied the following code from
http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index
3.html (code sample 36):

 

Transformer serializer =
TransformerFactory.newInstance().newTransformer();

            serializer.transform(new DOMSource(parameters), new
StreamResult(System.out));

 

(parameters is the SOAPElement). In the output I noticed that every
element has 10+ namespace declarations. Not all of them are used
(xmlns:xml is included, some parsers complain about this even though it
is set to the only correct value 'http://www.w3.org/XML/1998/namespace')
and most of them only have to be declared on the root element anyway.

 

I've also tried the Xerces XMLSerializer, with the same result. I
realize this is probably a SAAJ problem, but I couldn't find any source
code to it, and the SAAJ mailing lists are as good as empty.

 

Does anyone know why this happens, and how I can output cleaner, more
readable xml?

 

 

Kind Regards,

 

Wannes Sels