I am trying to develop a simple xml editor. I have an object that has a TreeView. I use the TreeView to display the Xml node info. That's all fine, but i want the user to be able to move the actual xml nodes about by interacting with the non-xml TreeView nodes.
my basic algorithm is as follows:
- user has selected a treeview node
- if user presses Ctrl+Up Arrow, then
- clone the corresponding xml node
- remove the xml node
- insert the xml node CLONE into the parent xml
node's child list BEFORE the node that was
above the node to start with
the treeview nodes are working just right...but to my dismay, when remove the selected xml node...the parent also disappears!
basically, I am doing this...
Expand|Select|Wrap|Line Numbers
- Dim nodeToRemove As XmlNode = Me.xmlDoc.SelectSingleNode("//page[@id=/website/@currentPageId]")
- Dim parentNode As XmlNode = nodeToRemove.ParentNode
- parentNode.RemoveChild(nodeToRemove)
any ideas?
thanks in advance.