Quick update:

 

I've still got the XmlValueDisconnectedException problem on some node delete
operations.  It seems that check_orphaned() may be failing.  Still looking
for a solution/example that doesn't throw this exception.

 

Regarding points 2 and 3 below, I did figure out that the extra children in
the DOM structure was just the text between nodes.

 

Matt

 

  _____  

From: Matthew Fadoul
Sent: Tuesday, September 09, 2008 6:53 AM
To: 'user@xmlbeans.apache.org'
Subject: Looking for an example of JTree with Xmlbeans (adding and deleting
nodes)

 

Hi all,

 

I'm having a bit of trouble with deleting nodes in a tree.  I used XmlBeans
to create Java code from my schema, and am trying to connect it to a JTree
in Swing.  I've looked at the example on the XmlBeans website
(http://xmlbeans.apache.org/samples/XmlTree.html), but I don't think it does
deletes.  Here are some details:

 

1) I'm running into the xmlvaluedisconnectedexception.  I've done a few
google searches, but haven't found a clear solution yet.

2) I've got a pretty simple schema, with a node type that can be a parent of
zero or more of the same type.  For example:

 

MyNode (Parent)

-          My Node (Child 1)

-          My Node (Child 2)

-          My Node (Child 3)

-          My Node (Child 4)

 

When I get the array of children from the XmlBeans parent object, I see four
children.  When I grab the parent's "Node" object (i.e. from the DOM), the
DOM shows 9 children.  It seems that each child consists of a DOM Node
object and XmlObject object (for the MyNode data), plus an extra XmlObject
for good measure.  The formula seems to be (2 * num children) +1.
Unfortunately, when I do a delete, I am only able to remove the XmlObject.

 

3) On the other side, when I do an "add" to the list of children, I only add
one child object (according to the DOM structure).

 

If anyone could help with an example and/or point me toward a good
explanation of the things going on "under the hood", I would really
appreciate it.

 

Thanks!

 

Matt

Reply via email to