Just a side note: I prefer to create the schema _first_ because that is
something the user will face (I am thinking of configuration files
here). So first comes usability for the user and only then I bother how
that will be transferred into Java land. I use "trang" to generate an
XSD and modify it manually afterwards.
http://www.thaiopensource.com/relaxng/trang.html
If you are designing XML based persistence of Java classes then of
course your approach is at least equally valid. But I would do that
only if I am sure no human being needs to edit those XML files.
Kind regards
robert
Let me clarify a little bit, I'm not trying to do what JAXB does. I'm not
trying to marshall and unmarshall XML info to and from Java. In fact, The
XSD files produced *will* be compiled with xjc for that purpose but they
will *not* translate between XML and the annotated Java Classes which were
used to produce them.
I intend to automate the Methods in the annotated Java Classes, ie store
sequences of Method calls in XML files, read them into memory and then
invoke them in instantiated Object(s) of that type. I would like to start
with the Classes themselves, tag or annotate the Methods I want to make
available for automation, then generate an XSD which can be used by JAXB
for marshalling and unmarshalling, as well as for creating and editing
these "Command Strings" with validation. Eclipse, for instance, provides
something like the latter capability
There is probably some way to tag (or annotate!) a Java file so that a
Templating engine could generate the desired output, and I doubt that it is
very difficult. I was just asking to see what experience people here have
had with this sort of thing and give me some direction.
Thank you
P.S. the annotations I'm speaking of would indicate things like a Method's
name, it's return type and it's arguments. Right now such Methods only take
and return Java Primitives but that is because XML Schema makes it easier
to do since it provides simple types that correspond to each of them, and
that makes validation possible