L
Leon Mayne
I have an XmlDocument object, xdReportGroups, and I would like to find and
remove a node with a particular ID from the document. The node could be
several levels down the tree.
I have tried the below code:
Dim xnNodeToRemove As XmlNode =
xdReportGroups.DocumentElement.SelectSingleNode(String.Format("//ReportGroup[@ID='{0}']",
ViewState("InitialReportGroupId")))
If xnNodeToRemove IsNot Nothing Then
xnNodeToRemove.ParentNode.RemoveChild(xnNodeToRemove)
This seems to run through fine but the document is not affected. Does making
changes to a referenced child node not affect the document itself? If not
then does anyone know the best way to do this?
remove a node with a particular ID from the document. The node could be
several levels down the tree.
I have tried the below code:
Dim xnNodeToRemove As XmlNode =
xdReportGroups.DocumentElement.SelectSingleNode(String.Format("//ReportGroup[@ID='{0}']",
ViewState("InitialReportGroupId")))
If xnNodeToRemove IsNot Nothing Then
xnNodeToRemove.ParentNode.RemoveChild(xnNodeToRemove)
This seems to run through fine but the document is not affected. Does making
changes to a referenced child node not affect the document itself? If not
then does anyone know the best way to do this?