Friday 15 February 2013

java - Prevent generation of duplicate classes from XSDs without namespaces -



java - Prevent generation of duplicate classes from XSDs without namespaces -

i implementing functionally our netbeans platform application using classes generated jaxb using mojo maven plugin 'jaxb2-maven-plugin'. unfortunately creation of xsd files not in hands , confidential. trying provide minimal running illustration farther demonstrate hope can force me in right direction solely description.

we have many xsd files , got few additions in lastly weeks. 2 of these xsds (lets phone call them a.xsd , b.xsd) include xsd (lets phone call common.xsd) contains mutual types used both of other xsds. common.xsd has no namespace , should remain way.

this creates next problem: types defined in common.xsd there 3 duplicates generated xjc. 1 residing in bundle named 'generated' (exactly classes want use) , 2 others residing in packages of a.xsd , b.xsd same classes in 'generated' except few namespaces not needed me.

i understand reading few other questions on stackoverflow episodes resolve not getting work xsd without namespace.

my plugin configuration in pom pretty simple:

<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <configuration> <npa>true</npa> </configuration> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution> </executions> </plugin>

is there resolution problem using episodes special configuration or maybe kind of binding can utilize resolve this?

this explanation of why episodes fail, unfortunately, not reply question.

you can utilize jaxb:class/@ref binding map schema type onto existing class. see this post blaise.

in short, can like:

<jaxb:binding node="...point type here"> <jaxb:class ref="existingclass"/> <jaxb:binding>

in case existingclass reused type.

you trying create work episodes. episode, in essence set of such mappings. episodes utilize scd (schema component designator) point types, not node xpath-expressions. , scd namespace-driven. if have no namespace - or, improve - have chameleon namespace design, don't have right namespace. hence episodes fail.

the problem "common" classes should utilize namespace of "host" schema (this chameleon design about). namespace , local names provided in annotations. if have 1 set of classes , 1 set of annotations - have 1 namespace. @ moment don't see easy way have 1 set of "common" classes.

if can utilize a , b separately, is, not in same context @ same time possible trick annotation reader utilize specified namespace common.

but if want utilize , b @ same time, don't know how it. maybe invent namespace common , apply preprocessing replace namespaces mutual elements in , b namespace...

so not answer, more elaboration on backgrounds.

java maven jaxb xsd xjc

1 comment:

  1. Breedlove: Java - Prevent Generation Of Duplicate Classes From Xsds Without
    Namespaces - >>>>> Download Now

    >>>>> Download Full

    Breedlove: Java - Prevent Generation Of Duplicate Classes From Xsds Without
    Namespaces - >>>>> Download LINK

    >>>>> Download Now

    Breedlove: Java - Prevent Generation Of Duplicate Classes From Xsds Without
    Namespaces - >>>>> Download Full

    >>>>> Download LINK eW

    ReplyDelete