How to modify Document through XML Edit


I am working on an application where I can drop icons from the the treeview toolbar and place them onto the document workspace. I can presently delete these icons from the workspace if I so wish by selecting the icon and deleting it or cutting it.
I have updated my application such that I can delete Icons from the TreeView Toolbar itself. What I wish to do is to have any corresponding icons already inserted into the document deleted authomatically as well (if I delete an icon from the toolbar).
Any ideas on how I can do this - or do I have to select each icon in the document and delete it manually.
[I am thinking I might have to manually delete a node from the underlying XML storage file.]


You’ll need to iterate over all of the nodes in your document(s) to see which ones correspond to the deleted TreeView icon/TreeNode.
I suppose you’ll need to do this whenever you open up a document, to look for obsolete stuff that you should delete. It would be nice if you gave the user an option about what to do.