Link to home
Start Free TrialLog in
Avatar of caoimhincryan
caoimhincryan

asked on

Compare xml node by node

Hi all,

I have 2 xml strings which will have the same elements and nodes..One is called OldValue and the other is NewValue. What I want to do is compare the 2 xml and see which nodes are different. Below is my 2 xml.We can see that the Specification node value is different (OldValue = 137650.9900 - NewValue = 137650.0000)

How can I compare these 2 xml and store the node or nodes that may be different?
//----------OldValue----------
<?xml version="1.0" encoding="utf-16"?><PhaseLabourCosts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><MachineType>E</MachineType><Planning>93000.0000</Planning><Specification>137650.9900</Specification><Design>664250.0000</Design><Construction>393700.0000</Construction><Installation>996000.0000</Installation></PhaseLabourCosts>
 
//----------NewValue----------
<?xml version="1.0" encoding="utf-16"?><PhaseLabourCosts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><MachineType>E</MachineType><Planning>93000.0000</Planning><Specification>137650.0000</Specification><Design>664250.0000</Design><Construction>393700.0000</Construction><Installation>996000.0000</Installation></PhaseLabourCosts>

Open in new window

Avatar of SameerJagdale
SameerJagdale
Flag of United States of America image

you might need to use XSLT for this. check the below link:
http://www.dpawson.co.uk/xsl/sect2/N1777.html
 
Avatar of caoimhincryan
caoimhincryan

ASKER

>> SameerJagdale - Is that link relevant to C# code?
caoimhincryan:
will tell you how to create .xsl file.
ASKER CERTIFIED SOLUTION
Avatar of Aaron Jabamani
Aaron Jabamani
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial