xsdjaxbxml-binding

Generate 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 the reverse is possible (i.e generation classes with javadoc comments from xsd with comments).

Please advice.


Solution

  • Using the JAXBContext.generateSchema(SchemaOutputResolver) API it is not possible for Javadoc comments to be included in <xsd:documentation> sections. The reason for this is that there isn't any API available to introspect the Java class/field/property to get the information in the comments.