Hi David

On 13/09/12 21:04, KARR, DAVID wrote:
-----Original Message-----
From: KARR, DAVID
Sent: Thursday, September 13, 2012 9:53 AM
To: [email protected]
Subject: How to hardwire XML namespace prefixes when generating from
schema?

I have one CXF project using version 2.3.2 (and others using newer
versions).  This project generates the JAXB classes from schema.  I'd
like to hardwire the namespace prefix we use.  I can see how to do that
with hand-coded JAXB classes in the package-info class, but I'm not
sure how to make that happen from schema.  Is there a way to do this?

Just so it's clear, I'm building JAX-RS services here, not JAX-WS.

I noticed an example in the docs referring to "Namespace Prefix Management" where a 
JAXBDataBinding gets a "namespaceMap" property.  This was apparently specific to JAX-WS.  
How would this work in JAX-RS?

I can see that starting from 2.4.x JAXBElementProvider has a 'namespacePrefixes' map property, however, the fix did not make it to 2.3.x, given that no releases are made on that branch any longer.

I'm not sure how to configure JAXB code generator to get that XmlSchema annotation into the package-info class which would do it for for 2.3.x.
Actually, according to
http://hwellmann.blogspot.ie/2011/03/jaxb-marshalling-with-custom-namespace.html, you can "-npa" option to get a customized package-info included.

Cheers, Sergey




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to