I have two xsds.  One imports the other one and contains a type that
inherits from a type within the imported file.  XmlBeans properly
generates a class that extends the base class.  When I use XmlBeans to
create a document, XmlBeans does not properly set the xsi:type.  If I
place the inherited type within the imported xsd, the generated XML
properly contains the xsi:type attribute.

 

If the changeType() method is called when the type is in the same xsd,
the proper type is returned.  When called with a type that is in the
second xsd that inherits the base type, XmlBeans is not able to change
the schema type.  Is this expected behavior, or a defect?  Is there an
XmlOption or other configuration that is required to get this to work?

 

If I create an XML document with the generated XmlBean classes with an
element inherited from both xsds I get the following:

 

<Main xmlns="http://www.example.org/XsdTest";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

  <Base remoteProp="subProp" baseAttr="baseAttr" xmlns=""/>

  <Base baseAttr="base" anotherAttr="another" xsi:type="xsd:LocalType"
xmlns:xsd="http://www.example.org/XsdTest"; xmlns=""/>

</Main>

 

Note that the second element uses the type that inherits from the
original xsd.  It has the xsi:type properly set.  The first element is
from the secondary xsd that imports the first.  If I use the
changeType() method on the first element, I get the original XmlBean
object without any warnings what went wrong, even though I set the
actual concrete class into the array.

 

I've attached two xsds and a java class that exhibits the incorrect (in
my mind) behavior.  Does anyone know whether this is correct or not?

 

Thanks,

 

  Chris Schmidt 

 



The information contained in this email may be confidential and/or legally 
privileged. It has been sent for the sole use of the intended recipient(s). If 
the reader of this message is not an intended recipient, you are hereby 
notified that any unauthorized review, use, disclosure, dissemination, 
distribution, or copying of this communication, or any of its contents, is 
strictly prohibited. If you have received this communication in error, please 
contact the sender by reply email and destroy all copies of the original 
message. Thank you


Attachment: xsdBase.xsd
Description: xsdBase.xsd

Attachment: inheritType.xsd
Description: inheritType.xsd

Attachment: XsdTest.java
Description: XsdTest.java

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to