Best way to learn for what you need to is to look at the implementation of 
xsd2inst tool:


On May 6, 2014, at 11:19 AM, jgagnon <> wrote:

> I am working on a project where we are trying to dynamically generate XML
> instances, using the information gleaned from a defining XML schema.  The
> instances will represent test cases for a given "message" type.
> I've experimented with the XMLBeans schema type system to get useful
> information about the types defined in the schema, such as the structure
> (sequences, choices, etc.), min/max occurs and various restrictions
> (enumerations, patterns, etc.). This information will be used to determine
> what types of test cases will be generated for a given message element.
> I'm at the point where I'd like to use the XMLBeans Java API to
> programmatically generate XML document instances. Of course, I would need to
> compile the schema to generate a Java library of classes that represent the
> Java form of the message types (and supporting types).
> What I don't know is how to dynamically use the generated API to create an
> object hierarchy representing a test case.  The hierarchy would represent a
> message instance (which may or may not be valid or complete based on the
> test case), with element content populated with test data.
> I cannot seem to find the information from the schema type system that would
> allow me to "bridge" between the schema information and the specific
> generated API classes that would need to be used to generate the object
> hierarchy.
> I assume if this information is available, I would then need to use
> reflection to create the objects and set their values and attributes.
> Does anyone have suggestions?
> --
> View this message in context: 
> Sent from the XMLBeans User mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to