I tried asking this on StackOverflow, but then realized that this email list is 
probably the better place, so please forgive if you read both places.  I hope 
someone can please find time to answer.

We use XmlBeans, code generated from a schema, to read in an XML instance that 
conforms to the schema and modify it.  Read and validate work fine; modify is 
killing me.  For example, change the value of an element, delete an element 
from a list, etc.  I am using Java method calls like removeMyElement(i) to 
remove the element at position (i).  I am not using Cursors or any low-level 
DOM access.

We thought it would be convenient to walk thru the document, gather a list of 
elements (i.e., references to XmlBeans objects) that need to be modified or 
nuked, then iterate over the list changing them.  But use of a cached object 
reference is where I run into the ditch: I get XmlValueDisconnectedException.  
I read that this means the XmlObject has become disconnected from its 
underlying store. But I have not discarded the Document!

Does every change to an XmlObject backed by the XmlBeans XmlStore cause all 
existing references to become invalid?  I don't yet have the right mental model 
for what's going on when I call the java methods.

I checked the XmlBeans FAQ and the sample code for guidelines.  I found many 
samples at http://xmlbeans.apache.org/samples/ that show how to create an 
object from scratch, how to read in XML, how to validate XML, etc.  
Unfortunately I didn't find a sample that does a messy change to the content. 
The FAQ at http://wiki.apache.org/xmlbeans/XmlBeansFaq doesn't have a good 
question on this either.

Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to