users@jax-rpc.java.net

Re: serializing SOAPElement

From: Vishal Mahajan <Vishal.Mahajan_at_Sun.COM>
Date: Tue, 18 Jan 2005 15:35:09 +0530

You might want to make sure that the DOM structure you're trying to
serialize doesn't have these many namespace declarations in the first
place. You may want to count the number of declarations the soap element
has before you serialize it.

Vishal

Sels Wannes wrote:

> 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/index3.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
>
>
>