I don't see the issue using XPath if you already know the structure of the XML document beforehand. Otherwise you probably would be better of using SAX parsers (you don't intend to modify the XML, right?) Iterate through the elements/nodes in a breadth first or depth first fashion and compare each against the other. Does this answer your query?
Hi Bhavya, Here is a suggestion. I have a tool at my desk to compare two xml files. It compares, highlights the changes and allows us to edit and save the changes on requirement. But I m not sure about how far it would help you in Xpath search. I have the tool with opensource. Better you try in enhancing the coding according to your requirement. The tool is XML Comparer from wbcsoftwarelab. Hope your trouble solved dear. Review and reply.