users@jaxb.java.net

Re: accessing schema info at runtime

From: JAXB User <jaxbuser_at_yahoo.com>
Date: Thu, 4 Aug 2005 10:55:14 -0700 (PDT)

Thanks, this is helpful. One follow-up question: if I want to whether each sub-element is required or not (i.e. minOccurs > 0), is this information available as well?
 
Thanks for the help!
 
Giac

Dmitri Colebatch <colebatchd_at_gmail.com> wrote:
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 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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net


                
---------------------------------
 Start your day with Yahoo! - make it your home page