I have two XML documents. They have identical structures although they contain different data. The "new" one has a node that is needs to be updated with information from the "old" one. The "old" document has an accurate version of that node.
I am an XML novice but I can use the various commands to get the relevant node from the two documents. I can look at the nodes by using the .ToString property so the string information is viewable and it is what I expect. So I now have two nodes xmlOldDotInfo - a XmlNode from the old document xmlNewDotInfo - a XmlNode from the new document What I want to do is replace the node in the new document with the node from the old document. You cannot simply assign the string value xmlNewDotInfo.ToString = xmlOldDotInfo.ToString is not a valid statement but it expresses what I am trying to do So I would guess that I should be using the ReplaceChild method, but I guess I do not understand the syntax ________________________________________________________________________ _ ReplaceChild Parameters: NewChild as XMLNode, OldChild as XMLNode Function: Replaces oldChild with New child. Optionally returns a reference to the new child as an XMLNode. ________________________________________________________________________ __ Now I can get the parent of xmlNewDotInfo -- say it is xmlParentNode This SEEMS to be what I want to do but it does not work xmlParentNode.ReplaceChild(xmlNewDotInfo, xmlOldDotInfo) 'this causes an exception Because of the "Optionally returns a reference to the new child as an XMLNode" business I have also tried Dim xmlReferenceToNew As new XmlNode xmlReferenceToNew = xmlParentNode.ReplaceChild(xmlNewDotInfo, xmlOldDotInfo) 'this also causes an exception So my question is two-fold 1. Is .ReplaceChild the method I should be using to try and accomplish what I am trying to accomplish. If not, what approach should I be using. 2. If it is .ReplaceChild how am I using it incorrectly? ________________________________________________________________________ _____________________________ Now there seems to be a little crack in that the property .Value can be assigned things which the property .ToString cannot. Value String Used in some nodes to set or get the value, such as TextNode. Not supported for all node types. but xmlNewDotInfo is not at the end of the line. It has a lot of sub nodes etc. I cannot imagine how I would write the code to use Value as the approach to this problem. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
