RE: changeType to type with fewer element

Cezar Andrei <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <32958cc8-b08a-4cef-94b3-91d28d2115dc@default>
Oliver,

 

I'm not sure what is your question, but you have to keep in mind that validation is run only when validate() method is invoked. 

Especially when it is structure related operations modifying the document don't keep the document valid. Most of the time a document has to go through a series of invalid states to become valid again. XMLBeans' user cooperation is required to attain document's validity after modifications.

 

Cezar

 

  _____  

From: Oliver Pfau [mailto:[email protected]] 
Sent: Friday, November 13, 2009 7:03 AM
To: [email protected]
Subject: changeType to type with fewer element

 

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.