I want to compare two XML nodes in one XML file, compare were are differences and write summary.
Here is my xml data:
<AuditLog>
<OldValue>
<ProcessCategory>
<CategoryId>3</CategoryId>
<ChildCategories />
<Created>2012-12-13T11:39:30.747</Created>
<Name>New category name</Name>
<ParentCategory />
</ProcessCategory>
</OldValue>
<NewValue>
<ProcessCategory>
<CategoryId>3</CategoryId>
<ChildCategories />
<Created>2012-12-13T11:39:30.747</Created>
<Name>Old Category name</Name>
<ParentCategory />
</ProcessCategory>
</NewValue>
</AuditLog>
I need result like:
Difference in property category Name, old value: “Old Category name”, new value: “New category name”
Can anyone help me, please?
You can iterate thru all properties and compare their values. If object’s structure is not more nested then in your example, this should work: