JAXB List Tag creating inner class

前端 未结 5 1147
无人及你
无人及你 2020-12-16 17:29

So we have an XSD type in the form:


    
        
            

        
5条回答
  •  悲&欢浪女
    2020-12-16 17:57

    Maybe below sample helps.

    XML Schema

     
        
    
          
            
              
              
            
          
        
    

    Java class :

    public class Test {
    
        protected List dataList;
        protected String str;
        public List getDataList() {
            if (dataList == null) {
                dataList = new ArrayList();
            }
            return this.dataList;
        }
    
        public String getStr() {
            return str;
        }
    
        public void setStr(String value) {
            this.str = value;
        }
    
    }
    

    EDIT 1:

    You can reverse engineer from java code to xsd. in JAVA_HOME/bin there is schemagen executable.

    Give your java code and it will create the XSD schema for you using your java class.

    see this link

    schemagen myObj1.java myObj2.java
    

提交回复
热议问题