My function iterates through every node of an instance of an XMLDocument
. It checks to see if the current node's name is in a lookup list. If it is, it applies appropriate validation to the value of the current node.
When the validation method indicates that the value has been changed, I want to replace the value in the original document with the updated value.
I think the easiest way to achieve this might be to write out to an XMLTextWriter
as I process each node in the original XMLDocument
, either writing out the original or modified node and value as appropriate. This method would rely on determining whether the current node has any children, or is a stand-alone node.
Is there a better way I could update the values in the original document? I need to end up with the complete XMLDocument
, but with updated node values, where appropriate.
Thanks in advance.