look at the XmlCursor api. You can use it to create an xml document.

On 5/6/2014 8: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: 
http://xmlbeans.996285.n3.nabble.com/Dynamic-generation-of-XML-object-hierarchy-using-schema-tp7501.html
Sent from the XMLBeans User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to