users@jaxb.java.net

Re: Digest for list users_at_jaxb.java.net

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Thu, 27 Jun 2013 10:23:44 +0200

See
   https://jaxb.java.net/guide/How_modularization_of_schema_interacts_with_XJC.html
for a short discussion, make sure to follow its link
   http://www.kohsuke.org/xmlschema/XMLSchemaDOsAndDONTs.html#avoid_chameleon

Whatever you do, you're likely to be up the creek because there is no
way a single Java class can be JAXB-annotated into two (many)
different namespaces. But that's exactly what the described technique
does. So, if XML instance documents produced by some legacy code put
currency amount elements in orders or articles into the order or
article namespace respectively, you can't unmarshal them with a
CurrencyAmount class tied to a single namespace.

Plan for a better future. Put the common types into a new namespace.
Modify schemas so you can generate a nice set of Java classes that's
convenient for application development. Be prepared for XSLT
transformations of instance documents.

-W






On 27/06/2013, Lulseged Zerfu <lulseged.zerfu_at_ericsson.com> wrote:
> Hi
>
> I had same problem days ago and I have figured out how to solve it.
>
> 1. First you need to create one separate java project for your common
> schema.
> Include only your common schema in this new project.
> Customize if needed, package etc. (binding.xjb)
>
> 2. Add your new project as a dependency where common schema is used
> currently.
>
> 3. Update your configuration section of pom.xml files where you have common
> types today:
>
> <configuration>
> <episodes>
> <episode>
> <groupId>group id for common-types</groupId>
> <artifactId>common-types</artifactId>
> </episode>
> </episodes>
> </configuration>
>
> 4. Remove any customization elsewhere for common types.
>
> Hope this will help to solve your problem.
>
> BR
> Lulseged
>
> -----Original Message-----
> From: users-request_at_jaxb.java.net [mailto:users-request_at_jaxb.java.net]
> Sent: den 27 juni 2013 02:33
> To: users_at_jaxb.java.net
> Subject: Digest for list users_at_jaxb.java.net
>
> Table of contents:
>
> 1. Common Type in xs:include - "Martin Lemanski" <Martin.Lemanski_at_gmx.at>
>
>