Win a copy of Kotlin Cookbook this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

JAXB SCD change the class name generated from a complex type from schema

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like to change the class name generated from a complex type from the following schema common.xsd.
"UserType" rename to "User",
"UserWithEffectiveDateType" rename to "UserWithEffectiveDate".
I tried JAXB (v2.2.6) customization with "schema component designator" (SCD).
However, output consists of "UserType" and "User", "UserWithEffectiveDateType" and "UserWithEffectiveDate".
How to fix this problem?

common.xsd:



user.xsd:



scd.xjb:


build.xml:



output
UserWithEffectiveDate.java:
 
Marshal
Posts: 24853
60
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me that the easiest way to do that would be to edit those documents and make the appropriate changes. For example where you have



you could change that to



and so on. No?

 
A Kao
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:Seems to me that the easiest way to do that would be to edit those documents and make the appropriate changes. For example where you have



you could change that to



and so on. No?


Business requirement prevent changing the xsd file.
 
Paul Clapham
Marshal
Posts: 24853
60
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A Kao wrote:Business requirement prevent changing the xsd file.



I'm surprised that you have a business requirement which is so important that it protects the document by making it unusable.

But fine, let's suppose the business managers know what they're doing. Then make a copy of the document and edit it to be usable.
 
A Kao
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

A Kao wrote:Business requirement prevent changing the xsd file.



I'm surprised that you have a business requirement which is so important that it protects the document by making it unusable.

But fine, let's suppose the business managers know what they're doing. Then make a copy of the document and edit it to be usable.


I work for the government.
Changing these business requirements require agreement from all stakeholders, which will take a long time.
That is why I try to figure out a way to change the class name generated from a complex type from schema.
JAXB SCD approach is close, is that any workaround?
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!