How to parse an XML diff to show only differences

Loyd

New Member
I compare the xml of two serialized objects using the MS XmlDiffPatch tool. (C#)XML Sample 1:\[code\]<HotelBookingView xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>119</Id> <RoomId>1</RoomId> <NumberNights>4</NumberNights> <CourseBookings> <CourseHotelLink> <Id>0</Id> </CourseHotelLink> </CourseBookings> </HotelBookingView>\[/code\]XML Sample 2:\[code\]<HotelBookingView xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>119</Id> <RoomId>1</RoomId> <NumberNights>5</NumberNights> <CourseBookings> <CourseHotelLink> <Id>0</Id> </CourseHotelLink> </CourseBookings> </HotelBookingView>\[/code\](NumberNights has changed from 4 to 5)The Diff between them:\[code\]<?xml version="1.0" encoding="utf-8" ?> <xd:xmldiff version="1.0" srcDocHash="14315823970661993399" options="IgnoreChildOrder" fragments="no" xmlns:xd="http://schemas.microsoft.com/xmltools/2002/xmldiff"> <xd:node match="1"> <xd:node match="3"> <xd:change match="1">5</xd:change> </xd:node> </xd:node>\[/code\]Any advice on how to process the diff to be able to show only the differences between the two?I'd like a final display that just showsNumberNights: oldvalue (4), new value (5)The Xml Diff Tool has a GetHtml() function but it displays all the values and just highlights those that have changed. Currently to get just the difference I look through the produced html for the CSS 'lightgreen', then do string-manipulation to find the name of the node.. which is insane and really slow for a table full of audit data! Any better ideas appreciated!
 
Back
Top