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/