Re: Dynamic generation of XML object hierarchy using schema

Cezar Andrei <[email protected]> Tue, 6 May 2014 10:58:45 -0700 (PDT)
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Joseph,

Best way to learn for what you need to is to look at the implementation =
of xsd2inst tool:
=
http://svn.apache.org/viewvc/xmlbeans/trunk/src/tools/org/apache/xmlbeans/=
impl/xsd2inst/SchemaInstanceGenerator.java?view=3Dmarkup

Cezar


On May 6, 2014, at 11:19 AM, jgagnon <[email protected]> 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.
>=20
> 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.
>=20
> 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).
>=20
> 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.
>=20
> 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.
>=20
> I assume if this information is available, I would then need to use
> reflection to create the objects and set their values and attributes.
>=20
> Does anyone have suggestions?
>=20
>=20
>=20
> --
> View this message in context: =
http://xmlbeans.996285.n3.nabble.com/Dynamic-generation-of-XML-object-hier=
archy-using-schema-tp7501.html
> Sent from the XMLBeans User mailing list archive at Nabble.com.
>=20
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>=20