users@jaxb.java.net

Re: Is there a way to read schema in order to get meta data information?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 19 Feb 2003 15:50:06 -0800

> Is there a way I can read an schema file to get meta data information?
> Assuming I have schema that allows an element to have only 2 values
> (VALUE1 and VALUE2), can I get these allowable values out of the schema
> - so that I can put them in some UI widget (JCombobox maybe).

Being able to parse a schema file and inspect definitions in it would be
useful by itself, so chances are somebody already has developed such a
library. Just google it and you would probably find something.

JAXB internally uses XML Schema object model library, and I'd like to
release it as a standalone library, but at this moment I'm not sure if
that will happen. I also wrote Multi-Schema Validator which gives you
some degree of schema reflection. Castor and several other vendors have
schema object model by themselves, so you might want to check them out,
but none of them are quite good IMHO.


If you just need to list up the options of an enumeration, it seems to
me that you don't really need to go all the way down to XML Schema. You
can just use Java reflection.



regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com