You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "mark.nelissen" <ma...@gmail.com> on 2013/08/26 17:37:12 UTC

Formatting xmlbeans web service output in CXF

Our project publishes its web services through CXF, using xmlbeans for the
marshalling. This combination generates xml without namespace prefix
declarations, leading to repeated default namespace declarations each time
an element is in another namespace than its parent. 
Example:


This behaviour doubles the size of the xml message. It would gain us much
space, and be more logical/readable, to define the used namespaces on top,
using prefixes.

I have managed to activate the use of namespaces, by use of the xmlbeans
namespace hack in CXF.


This causes the namespaces to be declared using prefixes, but they are still
at the same locations, and thus needlessly repeated, adding even more size
to the messages.

Setting an XMLOptions instance, configured with the saveAggressiveNamespaces
property on the returned xml beans object does nothing:


How can I make CXF marshal the xml beans response object to output something
like:




--
View this message in context: http://cxf.547215.n5.nabble.com/Formatting-xmlbeans-web-service-output-in-CXF-tp5733051.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Formatting xmlbeans web service output in CXF

Posted by vincentr42 <vi...@gmail.com>.
To those who could have the same issue:
Mark and I found a "hacky way" to avoid repeated namespaces declarations.

We had to copy-paste and modify the CXF DataWriter to push the xmlbeans
"saveAggressiveNamespaces" option.

Here the two classes involved:








--
View this message in context: http://cxf.547215.n5.nabble.com/Formatting-xmlbeans-web-service-output-in-CXF-tp5733051p5752098.html
Sent from the cxf-user mailing list archive at Nabble.com.