Hi all.
I took a quick scan though the archive and some google searches but did not
find what I was looking for.  If I missed a good link, please provide it.  I
am using Xml Beans 2.2 in my project and all is well, very well in fact.  I
am not an expert and am fairly new, but so far its been very intuitive for
me.  But one small thing is bugging me and I can't find a way to fix it (if
its possible).

In my xsd, I define a base type and multiple types that extend the base
type.  It is esentially an abstract object, with more detalied and specific
objects extending the abstract object.  This is reflected in the generated
source and interfaces, as the specific types really do extend the base
object.  I am 99% sure my schema is defined properly, so I don't think its
it, but I could be wrong.  The base type has a few attributes and the
specific types each specific attributes that belong to it only (whereas base
ones are available to all specific types)

Now, the problem, is that when something occurs involving the specific
types, the base class is referenced in a way that I don't want.  I know its
not wrong, and the xml I have validates, but it doesn't look the way I want
it to.  Best described with an example.  In this example, the info tag will
add a new base type by default, but really I add a specific type since each
contains more info specific to that type.  And this is obviously allowed
since the specific type is also a base type (through inheritance).  Fyi, the
namespace prefix indicates cei=base type, odis=specific type.

How can I get it such that it looks like the way I want it, not the way I
currently get it?  I want the specific type to be in the tag, not the base
type and a reference to it using xsi:type.  I know the base type will need
to be referenced because they are not in the same namespace, but I don't see
why it is the type in the tag, when really it is the specific type being
used.  Is there a setting in XmlOptions that says always use specific type,
never base type?  Or is there something I have to set in the xsd?  I have
tried lots of different settings, btu have been unsuccessful thus far.

Thanks.
Jeff G.

*This is what I currently get:*
     <m:op>
      <m:info>
        <cei:baseType xsi:type=SpecificType>
          <cei:attr1>String</cei:attr1>
          <cei:attr2>2001-12-17T09:30:47.0Z</cei:attr2>
          <odis:attrX>String</odis:attrX>
          <odis:attrY>2001-12-17T09:30: 47.0Z</odis:attrY>
        </cei:baseType>
      </m:info>
    </m:op>

*This is what I want:*
    <m:op>
      <m:info>
        <odis:specificType>
          <cei:attr1>String</cei:attr1>
          <cei:attr2>2001-12-17T09:30:47.0Z</cei:attr2>
          <odis:attrX>String</odis:attrX>
          <odis:attrY>2001-12-17T09:30:47.0Z</odis:attrY>
        </odis:specificType>
      </m:info>
    </m:op>

Reply via email to