Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18982

Re: Best way to generate XSD from Java

From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Best way to generate XSD from Java
Date 2012-09-28 23:35 +0200
Organization A noiseless patient Spider
Message-ID <k4557n$oc0$1@dont-email.me> (permalink)
References <1lz5htc7ru4px.y4dvutffaftd$.dlg@40tude.net> <5065f23e$0$285$14726298@news.sunsite.dk> <1w8k70m8bfjn7.g6ysc3inyk4d$.dlg@40tude.net> <acmcf7Fl42U1@mid.individual.net> <1ufgvja2wnfn2$.1uat2fmq12932$.dlg@40tude.net>

Show all headers | View raw


On 28/09/2012 22:54, the don allegedly wrote:
> 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

Uh, indeed, you're not trying to do what JAXB does, and I am doubtful
whether it will be of use to you at all. An XML document is, an XSD
describes, and the Java Binding API binds, *data structures*. They have
no concept of methods as such.

You'll probably be better off writing your own annotation parser and
generating the schema on the fly (and pondering whether to use JAXB
annotations or your own). See
<http://docs.oracle.com/javase/6/docs/technotes/guides/apt/index.html>
and
<http://docs.oracle.com/javase/6/docs/jdk/api/apt/mirror/overview-summary.html>
for more information.

-- 
DF.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Best way to generate XSD from Java the don <donald@idaho.org> - 2012-09-28 14:30 -0400
  Re: Best way to generate XSD from Java Arne Vajhøj <arne@vajhoej.dk> - 2012-09-28 14:53 -0400
    Re: Best way to generate XSD from Java the don <donald@idaho.org> - 2012-09-28 15:21 -0400
      Re: Best way to generate XSD from Java Robert Klemme <shortcutter@googlemail.com> - 2012-09-28 21:34 +0200
        Re: Best way to generate XSD from Java the don <donald@idaho.org> - 2012-09-28 16:54 -0400
          Re: Best way to generate XSD from Java Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-09-28 23:35 +0200
          Re: Best way to generate XSD from Java Arne Vajhøj <arne@vajhoej.dk> - 2012-09-28 23:14 -0400
          Re: Best way to generate XSD from Java markspace <-@.> - 2012-09-29 01:34 -0700
            Re: Best way to generate XSD from Java Robert Klemme <shortcutter@googlemail.com> - 2012-09-29 12:43 +0200
          Re: Best way to generate XSD from Java Robert Klemme <shortcutter@googlemail.com> - 2012-09-29 12:55 +0200
        Re: Best way to generate XSD from Java Arne Vajhøj <arne@vajhoej.dk> - 2012-09-28 23:02 -0400
  Re: Best way to generate XSD from Java Roedy Green <see_website@mindprod.com.invalid> - 2012-09-30 04:03 -0700
    Re: Best way to generate XSD from Java Robert Klemme <shortcutter@googlemail.com> - 2012-09-30 17:24 +0200

csiph-web