Compiling multiple schemas into different packages using JAXB 2.1

前端 未结 5 1049
猫巷女王i
猫巷女王i 2021-01-02 03:40

I have a CommonTypes.xsd which I\'m including in my all other XSDs using xs:include. I get

Multiple  are defined for the target namesp         


        
5条回答
  •  Happy的楠姐
    2021-01-02 04:18

    I know it is an old post, but, as there is no answer for the exact question, here is my proposal:

    As mmoossen explained, the trick is to specify different namespaces for the XSDs. But, adding a namespace attribute in the jxb:bindings tag doesn't work:

    
    

    Instead of that, you need to add a targetNamespace attribute to the xs:schema tags of your XSDs:

    
    

    Once done, you will be able to have 1 external customization file (.xjb) declaring different schemaBindings, each of them possibly using a different package:

    
    
    
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
    
    

提交回复
热议问题