Unanswered XML Node Comparision

  • Thursday, June 07, 2012 2:29 PM
     
     

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

    Thanks in advance.