It should be possible (and relatively easy to add code to Castor XML (the code 
generator, mainly) to add a new annotations member to any generated class in 
addition to the current mode of 'injecting' the documentation annotations into 
the Javadoc.

Can you please register a new 'feature request' at 

http://jira.codehaus.org/browse/CASTOR

and attach all relevant information (mainly from this thread). Having said 
that, if you happen to have some ideas and time to help us implementing this, 
any patch would be appreciated ... ;-).

Werner

> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag
> von Régis Décamps
> Gesendet: Sonntag, 06. Mai 2007 17:55
> An: [email protected]
> Betreff: Re: [castor-user] Get description from java code
> 
> On 5/6/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> > Sorry, it isn't clear to me what you are trying to achieve. Can you
> > please provide me with a short sample demonstrating your needs ?
> >
> 
> First of all, thanks for your interest in my question.
> 
> I can illustrate this with a code snippet.
> 
> suppose you have a XSD containing this (this is from maven settings.xsd)
>   <xs:complexType name="Settings">
>     <xs:annotation>
>       <xs:documentation source="version">1.0.0</xs:documentation>
>       <xs:documentation source="description">Root element of the user
> configuration file.</xs:documentation>
>     </xs:annotation>
>     <xs:all>
>       <xs:element name="localRepository" minOccurs="0" type="xs:string">
>         <xs:annotation>
>           <xs:documentation source="version">1.0.0</xs:documentation>
>           <xs:documentation source="description">The local
> repository.</xs:documentation>
>         </xs:annotation>
>       </xs:element>
>     </xs:all>
>   </xs:complexType name="Settings">
> 
> Castor will nicely generate a Settings.java Class.
> 
> /*
>  * This class was automatically generated with
>  * <a href="http://www.castor.org";>Castor 0.9.7</a>, using an XML
>  * Schema.
>  * $Id$
>  */
> [...]
> /**
>  * 1.0.0Root element of the user configuration file.
>  *
>  * @version $Revision$ $Date$
>  */
> public class Settings extends SettingsType
> implements java.io.Serializable
> {
> [...]
> }
> 
> Here the <xs:description> was converted into javadoc ("root element of
> the user configuration file.")
> 
> I would like to access the content of <xs:description> from within my java
> code.
> 
> For instance, I'd like this test to pass:
> public void testGetDescription() {
>   Settings settings = new Settings();
>   assertTrue("Root element of the user configuration
> file.",settings.annotation.getDescription());
> }
> 
> My use case is that I write a GUI to edit a XML file, and I'd tooltips
> to show the description of each XML node.
> I generate the XML-Java binding with castor from a XSD.
> Since the XSD already has the description for each XML node, I don't
> want to hardcode the description, but I'd rather see my tooltips
> reflect the XSD content.
> Hope this makes sense to you.
> 
> Thanks in advance for your ideas.
> 
> --
> Régis
> 
> http://regis.decamps.info/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to