Creating an XML Schema with Documentation

Is there a way to generate XML Schema (xsd) with documentation ( <xsd:annotation> / <xsd:documentation>) from javadoc comments in classes? I know that the opposite is possible (e.g. generation of classes with javadoc comments from xsd with comments).

Please advice.

+3
source share
3 answers

Using the JAXBContext.generateSchema API (SchemaOutputResolver) , Javadoc comments cannot be included in the <xsd: documentation> sections. The reason for this is that there is no API property in the comments of the Java API / API / property to access the information.

+2
source

javadoc : (- @XmlDocumentation (lang = "en" content = "..." ))?

+1

Yes, now you can use jaxb2-maven-plugin

http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/index.html

But it is recommended to use the XmlType annotation, for me javadocs worked only when I do not use the attribute name of this annotation. I think this is a bug with the javadoc default renderer.

0
source

All Articles