You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Costie <Ch...@ngc.com> on 2006/04/18 20:56:46 UTC

changing SchemaType for an XmlObject

This is a bit of a newbie question regarding changing the SchemaType of an
XmlObject.

A high-level description of what I'm trying to do is as follows:

I'm building XML that contains a <detail> tag.  This tag is meant to hold
data from one or more sub-schemas.  If no sub-schemas are present, then the
tag is just blank (<detail/>).

On its own, a typical simple sub-schema tag might look like:
<track latitude="50.0" />

Within the final XML, I want to have the <detail> tag contain the exact same
data, so it would look like:
<detail latitude="50.0" />

I have generated classes using XMLBeans for both my main schema and one
sub-schema.  I have no problem creating an object and printing out the
resulting XML text if the <detail/> tag is blank - that's a fairly simple
task of just creating the objects and using basic setter methods to input
the data.

I can't get the <detail> tag to show any data, however.  I'm working on just
building an XML fragment of only a DetailDocument object, just to simplfiy
things.  If I try something like:

DetailDocument detailDoc = DetailDocument.Factory.newInstance();
detailDoc.changeType(TrackDocument.type);

I get an XmlValueDisconnectedException when trying to print out the xmlText
or String representation of the detailDoc object.  

I have tried creating the DetailDocument object using an XmlOptions object
(using XmlOptions.setDocumentType() to set the new schema), but that gives
the same error.  

Eventually, I have to use an object of type DetailDocument.Detail, which
will get set into my main XMLObject (of type EventDocument).  So how do I
have a DetailDocument object contain the data from a different schema?

Thanks for any possible help...
--
View this message in context: http://www.nabble.com/changing-SchemaType-for-an-XmlObject-t1470033.html#a3974491
Sent from the Xml Beans - User forum at Nabble.com.


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