If the element has minOccurs="0" in the Schema, you should see a method
like:

businessDescription.unsetBS7666Coordinate()

If your minOccurs is 1, then you can still remove it, but you will need
to use XmlCursor to do that. Anyway, IMO is better to change the
existing element to what you want it to be.

However, the fact that after setting the element to xsi:nil="true", this
attribute doesn't disappear after setting the element to something else
is disquieting and certainly a bug.

Radu

On Thu, 2008-02-28 at 17:16 +0000, Paul French wrote:
> This should be obvious but it isn't to me. I have generated classes from XML
> schema with XMLBeans.
> 
> The names of the objects are irrevelant.
> 
> I do the following:
> 
>     businessDescription.addNewBS7666Coordinate().setX(12345);
>     businessDescription.getBS7666Coordinate().setY(54321);
> 
> I want to remove the BS7666Coordinate object, how can I do this? I've tried:
> 
>     businessDescription.getBS7666Coordinate().setNil()
> 
>     businessDescription.setBS7666Coordinate(null)
> 
> Niether work? If I output the XML I get:
> 
>   <rol:BS7666Coordinate xsi:nil="true"/>
> 
> 
> Since I cannot see how to remove it I want to modify the object that I have
> added above and nullified by calling setNil:
> 
>     businessDescription.getBS7666Coordinate().setX(1111);
>     businessDescription.getBS7666Coordinate().setY(2222);
> 
> This gives:
> 
>   <rol:BS7666Coordinate xsi:nil="true">
>     <bs7:X>1111</bs7:X>
>     <bs7:Y>2222</bs7:Y>
>   </rol:BS7666Coordinate>
> 
> The nil attribute is still set?? Why? I can't see how to unset it.
> 
> If I try instead the following and attempt to replace the object with a new
> one:
> 
>     businessDescription.addNewBS7666Coordinate().setX(1111);
>     businessDescription.getBS7666Coordinate().setY(2222);
> 
> I get:
> 
>   <rol:BS7666Coordinate xsi:nil="true">
>     <bs7:Y>6868</bs7:Y>
>   </rol:BS7666Coordinate>
> 
> It appears the addNewBS7666Coordinate has failed yet passed back a valid
> object since setX is called. Then getBS7666Coordinate is called which brings
> back the orignal object and the Y value is set, hence the result. 
> 
> I must be miss understanding something fundamental about XMLBeans?
> 
> I suppose my question is how to add an object and then remove it and then
> add another?
> 
> Any ideas?
> 
> Thanks
> Paul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

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

Reply via email to