users@jaxb.java.net

Add Javadoc to generated XML schema?

From: aquinn <aquinn_at_ebi.ac.uk>
Date: Mon, 6 Jul 2009 07:24:49 -0700 (PDT)

Hello,

I'm using JAXB 2.1.9 to bind an existing Java object model to XML. As part
of this I'm generating the XML schema. I would like to include Javadoc
comments as xs:documentation elements in the generated XML schema. For
example:

public class Foo {

    private String fighter;
    private String yung;

    /** Returns the Fighter instance */
    public String getFighter() {
        return fighter;
    }

    /** Returns the current Yung entity */
    @XmlAttribute
    public String getYung() {
        return yung;
    }

}

Should produce:

<xs:complexType name="FooType">
  <xs:sequence>
    <xs:element name="fighter" type="xs:string" minOccurs="0">
      <xs:annotation>
        <xs:documentation>
          Returns the Fighter instance
        </xs:documentation>
      </xs:annotation>
    </xs:element>
  </xs:sequence>
  <xs:attribute name="yung" type="xs:string">
    <xs:annotation>
      <xs:documentation>
        Returns the current Yung entity
      </xs:documentation>
    </xs:annotation>
  </xs:element>
</xs:complexType>

Ideally I would like the option of adding Javadoc comments to the member
variables so my XML schema documentation can be worded differently to my
Javadoc comments. For example:

/** The current Yung entity */
@XmlAttribute
private String yung;

<xs:attribute name="yung" type="xs:string">
  <xs:annotation>
    <xs:documentation>
      The current Yung entity
    </xs:documentation>
  </xs:annotation>
</xs:attribute>

Any ideas?

Thanks,

Antony
-- 
View this message in context: http://www.nabble.com/Add-Javadoc-to-generated-XML-schema--tp24356414p24356414.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.