[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: RE: [jira] Updated: (XMLBEANS-362) XmlObject.changeType doesn't work when type inherits from importe
From: "Vinh Nguyen (vinguye2)" <vinguye2 () cisco ! com>
Date: 2008-02-22 20:31:04
Message-ID: F73CB8E31BDB1E42AFAA727635416E340550387D () xmb-sjc-22c ! amer ! cisco ! com
[Download RAW message or body]
Hi,
I think one alternative solution could be to use the following schema
instead. The output should have the xsi:type="RemoteType" attribute
you're looking for.
<xsd:complexType name="RemoteType">
<xsd:complexContent>
<xsd:extension base="base:BaseType">
<xsd:attribute name="remoteProp" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="Remote" type="inherited:RemoteType"/>
-Vinh
-----Original Message-----
From: Chris Schmidt (JIRA) [mailto:xmlbeans-dev@xml.apache.org]
Sent: Friday, February 22, 2008 11:21 AM
To: xmlbeans-dev@xml.apache.org
Subject: [jira] Updated: (XMLBEANS-362) XmlObject.changeType doesn't
work when type inherits from imported xsd
[
https://issues.apache.org/jira/browse/XMLBEANS-362?page=com.atlassian.ji
ra.plugin.system.issuetabpanels:all-tabpanel ]
Chris Schmidt updated XMLBEANS-362:
-----------------------------------
Attachment: XsdTest.java
Simple test that exhibits the problem. Note that it expects the
generated XmlBean objects to be in the classpath
> XmlObject.changeType doesn't work when type inherits from imported xsd
> ----------------------------------------------------------------------
>
> Key: XMLBEANS-362
> URL:
https://issues.apache.org/jira/browse/XMLBEANS-362
> Project: XMLBeans
> Issue Type: Bug
> Components: XmlObject
> Affects Versions: Version 2.3
> Reporter: Chris Schmidt
> Attachments: inheritType.xsd, xsdBase.xsd, XsdTest.java
>
>
> 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=""/> <!-- this
element should have an xsi:type of RemoteType -->
> <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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic