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:oliver.p...@scalaris.com] 
Sent: Friday, November 13, 2009 7:03 AM
To: user@xmlbeans.apache.org
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

 

Reply via email to