users@jaxb.java.net

Re: creating XML instance from XML schema

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 27 Sep 2013 06:50:46 +0200

On 26/09/2013, cgokey_at_comcast.net <cgokey_at_comcast.net> wrote:
> Hi everyone,
>
> I've seen a number of tools within IDE's that let you create an XML
> instance from a XML schema. I'd like to do this programatically and
> heard JAXB might be able to do this.
>
> Is there an API that will allow me to create an XML instance of a XML
> schema using the JAXB apis?

Out of the box: no.

But it wouldn't be too difficult to write some code using reflection to pass
through the assembled Java classes and create an object tree. But what
would you use for actual contents? And facets aren't available from the
generated code.

Perhaps a more X-oriented list (e.g. the XSL list) might be a better place,
and something like XSL a better tool to do what (I think) you want to do.

(What do the IDE tools use for data to put into the XML instance?)

-W

>
> Any help would be greatly appreciated!
> Chris
>