XML Node Comparision

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
I have 2 xml files and want to compare the 2 xml files and display the common nodes 1st by sorting the elements. The format of xml is given below.
If I have 2 similar xml files with few node values different , then how to compare 2 XML files and Rearrange the XMLnodes i.e "SelectedComponent"(in my example) based on Component Name present inside the node. I want to display the .xml file in a Treeview
so that it will be easy to make out the differences in the Common Nodes. If the Values inside the XML differs from the other XML file then I want to mark the Nodes in different color.

Could anyone help me to do it using Xlinq ..

<?xml version="1.0"?><br/>
<ProjectDescriptionXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema <br/>
<ProjectComponents><br/>
<SelectedComponent><br/>
<ComponentXMLPath>fyz.xml</ComponentXMLPath><br/>
<ComponentXML><br/>
<Component ComponentType="Football <br/>
<ComponentName>Football</ComponentName><br/>
<ParameterSet><br/>
<ParameterSetName>Players</ParameterSetName><br/>
<Comment>Beckam</Comment><br/>
<Parameters><br/>
<Parameter><br/>
<ParameterName>footballer </ParameterName><br/>
<Comment>Best</Comment><br/>
<Unit/><br/>
</Parameter><br/>
</Parameters><br/>
</ParameterSet><br/>
</Component><br/>
</ComponentXML><br/>
</SelectedComponent><br/>
<SelectedComponent><br/>
<ComponentXMLPath>xyz.xml</ComponentXMLPath><br/>
<ComponentXML><br/>
<Component ComponentType="Cricket <br/>
<ComponentName>Cricket</ComponentName><br/>
<ParameterSet><br/>
<ParameterSetName>Players</ParameterSetName><br/>
<Comment>Sachin</Comment><br/>
<Parameters><br/>
<Parameter><br/>
<ParameterName>Batsmen</ParameterName><br/>
<Comment>Best</Comment><br/>
<Unit/><br/>
</Parameter><br/>
</Parameters><br/>
</ParameterSet><br/>
</Component><br/>
</ComponentXML><br/>
</SelectedComponent><br/>
</ProjectComponents> <br/>
</ProjectDescriptionXML>

Thanks in advance.

View the full article
 
Back
Top