BTW, I found a workaround for not having it being displayed for every service.
I inject the map that is based on path and has a list of URI's. In my provider I check and get the correct list of URI's and pass them into my custom NamespacePrefixMapper in the createMarshaler() method. Very cumbersome. Not fond of it, but it does the trick. Jason -----Original Message----- From: Jason Chaffee [mailto:[email protected]] Sent: Thursday, December 02, 2010 1:13 PM To: Daniel Kulp; [email protected] Subject: RE: jaxb and namespaces Yes. My clumsy comment was really directed at JAXB and not CXF. JAXB's lack of support for interfaces is another big one, IMO. -----Original Message----- From: Daniel Kulp [mailto:[email protected]] Sent: Thursday, December 02, 2010 8:56 AM To: [email protected] Cc: Jason Chaffee Subject: Re: jaxb and namespaces On Thursday 02 December 2010 12:31:51 am Jason Chaffee wrote: > Another problem with this solution is that will add the define root > namespaces for all xml returned by all services even if those services > will never use those namespaces....very clumsy, IMO. Yea. This is an issue with JAXB. :-( I wish JAXB had better namespace control things, but that's kind of out of our hands. Dan > > -----Original Message----- > From: Jason Chaffee [mailto:[email protected]] > Sent: Wed 12/1/2010 8:49 PM > To: [email protected]; [email protected] > Subject: RE: jaxb and namespaces > > Found a solution by creating My own XMLProvider that overrides the > createMarshaler method and sets the > "com.sun.xml.bind.namespacePrefixMapper" on the marshaler. Would have > preferred a way to do this with annotations, while clunky, it does work. > > Jason > > -----Original Message----- > From: Jason Chaffee [mailto:[email protected]] > Sent: Wed 12/1/2010 5:02 PM > To: [email protected] > Subject: jaxb and namespaces > > I am using jaxrs and I have several namespaces being used in a single > service. Currently, all of those namespaces are being output inline in > each element. This is adding a lot of characters to the total size of > the document. Does anyone know of a way to force namespaces to be > defined in the root element? I was looking for a way to force this but > haven't had any luck so far. > > > > Thanks. -- Daniel Kulp [email protected] http://dankulp.com/blog
