I would like to suggest an addition to page 
http://wiki.apache.org/xmlbeans/XmlBeansFaq but I cannot edit it, so am trying 
the email list.   Please redirect me if I'm sending this to the wrong place. 

Is this Q & A sufficient and clear?  Thanks for listening.


Q: Why am I getting XmlValueDisconnectedException when I try to change an 
XmlObject?

A: The most likely cause is that the XmlObject is an orphan; i.e., it has 
become disassociated from the XML store.  This can happen if you get a 
reference to an object (perhaps by fetching the first item in an array), delete 
the item from the tree (perhaps by calling the array remove method on element 
0), and then try to invoke methods on that reference or any of its child 
elements.  You cannot even invoke the toString() method on an orphaned object!  
If you need to keep a deleted object, make a copy before you delete it. For 
example:

              LineItem nl = 
LineItem.Factory.parse(p.getLineItemArray(0).toString());
              p.removeLineItem(0);


Credit this to Paul Gillen and also the people who posted to a thread in 2006:

http://mail-archives.apache.org/mod_mbox/xmlbeans-user/200602.mbox/%3c99479f4d39c9244f8e17e688193a3dd8407...@repbex02.amer.bea.com%3E
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to