Compiling multiple schemas into different packages using JAXB 2.1

前端 未结 5 1025
猫巷女王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条回答
  •  清酒与你
    2021-01-02 04:15

    Yeah, there is a way.
    Assuming:

    xsd/common/common.xsd
    xsd/foo/foo.xsd 
    

    In the common directory place common.xjb:

    
        
        
     
    

    In the foo directory place foo.xjb:

    
        
         
     
    

    In the build.xml file, create one xjc task for each:

    
        
        
    
    
        
        
    
    

    You need to make sure that common.xsd has a targetNameSpace that is different from foo.xsd's targetNameSpace.

提交回复
热议问题