changeType to type with fewer element

Oliver Pfau <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Hi,

it seems that XmlBeans is generating invalid xml when I change the type to a type with fewer elements. There is an example with abstract conrete types on the XmlBeans homepage called "AbstractTypes". In the file AbstractTypes.java there is this section:

...
Circle circle = (Circle) s1.changeType(Circle.type);
circle.setRadius(10.0);
...

s1 is a shape (more common). If the type of circle is changed to a more common type, the radius is nevertheless set for the Shape type. The Validation of the changed circle to a Shape will fail, because the radius is existing in the xml event though the xsi:type is correct. The xml and the java representation seems to be here out of sync. Isn't it ? Or is there a trick ?

Regards,
Oliver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.