How to make generated classes contain Javadoc from XML Schema documentation

前端 未结 4 1412
太阳男子
太阳男子 2020-12-01 06:01

I\'m currently working with an XML Schema that has / on most types and elements. When I generate Jav

4条回答
  •  情话喂你
    2020-12-01 06:48

    I find the following techniques work pretty well for adding JavaDoc headers to Java element classes (generated from XML schemas). I nest the JavaDoc in tags defined in the jax-b namespace, nested within the xml schema annotation and appinfo tags. Note the jaxb namespace defines types of documentation tags; I use two of there: the class and the property tags. defined in the following namespace: xmlns:jxb="http://java.sun.com/xml/ns/jaxb"

    1) To document a class, I use a jaxb "class" tag in the following sequence:

      
         
            
               
                  
                     Documentation text goes here. Since parsing the schema  
                     into Java involves evaluating the xml, I escape all 
                     the tags I use as follows <p> for 

    . . . .

    2) To document an element, I use the "property" tag as follows:

           
              
                 
                    
                       
                          <p>Documentation goes here.</p>
                       
                    
                 
              
           
    

    3) I use the same set of tags to document attributes:

          
              
                 
                    
                       
                          <p>Documentation goes here.</p>
                       
                    
                 
              
           
    

    4) To document a choice, I use the property jaxb tag, and I document the choice.

        
              
                 
                    
                       
                          <p>Documentation goes here.</p>
                       
                    
                 
              
    
              
              
              
           
    

    Attempting to document the individual choices here would fail, since this tag produces an untyped list.

提交回复
热议问题