Here is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<xd:xmldiff version="1.0" srcDocHash="11928043053884448382" options="IgnoreChildOrder IgnoreNamespaces IgnoreWhitespace IgnoreXmlDecl " fragments="no" xmlns:xd="http://schemas.microsoft.com/xmltools/2002/xmldiff">
<xd:node match="2">
<xd:node match="2">
<xd:node match="19">
<xd:node match="2">
<xd:add>Y</xd:add>
</xd:node>
</xd:node>
<xd:add match="/2/2/11" opid="2" />
<xd:change match="18" name="OWNINGSITE">
<xd:node match="2">
<xd:remove match="1" />
</xd:node>
</xd:change>
<xd:add match="/2/2/2-9" opid="1" />
<xd:change match="17" name="STATUS">
<xd:node match="2">
<xd:remove match="1" />
</xd:node>
</xd:change>
<xd:remove match="14-16" />
<xd:remove match="13" subtree="no">
<xd:remove match="1-2" />
</xd:remove>
<xd:remove match="11" opid="2" />
<xd:remove match="10" />
<xd:remove match="2-9" opid="1" />
<xd:remove match="1" />
</xd:node>
<xd:node match="5">
<xd:node match="3">
<xd:node match="11">
<xd:change match="1">0,1,0,1,0,0,0,0,1</xd:change>
</xd:node>
</xd:node>
</xd:node>
</xd:node>
<xd:descriptor opid="1" type="move" />
<xd:descriptor opid="2" type="move" />
</xd:xmldiff>
I have written a c# code to parse through each node and get the value of match. I am unable to figure out how to parse through the nodes to get the values of all the matches. While debugging the code I found out that nodelist is not recieving the appropriate value through "xmlDoc.DocumentElement.SelectNodes("/node");" due to which foreach is not getting executed at all. Is my usage of "/node" right to get the values of its attribute "match"?
namespace demo
{
class Program
{
static void Main()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C:\\shreyas\\NX_Temp\\NX_Temp\\000048_A\\CompareReport3D.xml");
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/node");
string[] arr1 = new string[10];
int i = 0;
foreach (XmlNode node in nodeList)
{
arr1[i] = node.Attributes["match"].Value;
i++;
}
i = 0;
while (arr1[i] != null)
{
Console.WriteLine("the String=" + arr1[i]+ ":" + arr1[i++]+ ":" + arr1[i++]+":" + arr1[i++]);
}
}
}
}
I need to find the values of "match" in the form of string
output should be:
the String = 2:2:19:2