how to rename nested classes in jaxb xjc

前端 未结 2 939
面向向阳花
面向向阳花 2020-12-22 01:21

I have a wsdl that imports a schema I am trying to resolve xjc naming multiple nested MyElementName classes with the same name - which doesn\'t compile I have created this b

2条回答
  •  眼角桃花
    2020-12-22 01:56

    JAXB generates one class per one complex type, so I believe you should bind your custom class name to xs:complexType rather than xs:element. Your first XPath refers to the xs:element and I think JAXB does not know how to bind a class to it. Try this binding:

    
        
        
            
                       
        
            
        
    
    

    Personally, I prefer using JAXB to XMLBeans. You should be careful with the latter, because when compiling a deeply nested schema it may generate a structure of nested classes impossible to compile due to filename length limitations (usually 255 characters).

提交回复
热议问题