users@jaxb.java.net

Re: accessing schema info at runtime

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Thu, 4 Aug 2005 10:21:13 +1000

Have a look at java.lang.reflect.AnnotatedElement which both Class and
Method implement. Sample usage might be:

  Class clazz = ....
  XmlType xmlType = clazz.getAnnotation(javax.xml.bind.annotation.XmlType)
  String[] fields = xmlType.propOrder();
  foreach (String field : fields)
  {
    .... process each field.
  }

Does that help?

cheers
dim

On 8/4/05, JAXB User <jaxbuser_at_yahoo.com> wrote:
>
>
>
> Hello,
>
> I have a web-based forms application in which the structure of the form
> corresponds to an XML Schema while the data in the form corresponds to an
> instance of the XML Schema. I'd like to generate the HTML form using my
> JAXB 2.0 schema-generated classes and interfaces. With my simple types that
> are enumerations, I'm able to populate a drop down list since I can get the
> values of an Enum. However, I'd like to do a similar type of thing for
> complex content, that is create a drop down list that lists all of the
> possible sub-elements that can be contained by a given element.
>
> How can I get at this kind of schema information at runtime from the
> generated bindings?
>
> Thanks,
>
> Giac
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com