Hi, I have the following program :
string oldText= "<xml><xml1>text</xml1><xml1>text</xml1><xml>";
xmlDocument.LoadXml(oldText);
//...
var nodes = xmlDocument.SelectNodes("//*[contains(text(), 'text')]");
var node0 = nodes[0];
var node1 = nodes[1];
var newText = xmlDocument.OuterXml;
I need to find the specific index location of node0 in oldText (theoretically index = oldText.IndexOf(node0))
- will node0 always be the first one who appears in the OuterText ?
- how can I guarantee that oldText and newText will be exactly the same assuming that no changes were done to the values of the XML ?
- What is the best way of finding it in C# ?
The reason for this request is : oldText comes from a text editor that supports TextMarker. I attached a marker on each node and I need to retrieve the specific marker for each node. for that I need it's location in the string.
Thanks