EDN Admin
Well-known member
Hi all, i have to compare two xml. One is source XML and other is actual xml. I am writing both the xml :
Source XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Appointment>
<Id> 8 </Id>
<Date> 20060426 </Date>
<Subject> whatever </Subject>
<Place> where ever </Place>
<Modtime> 182204 </Modtime>
</Appointment>
Actual XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<agenda>
<appointment>
<Id> 7 </Id>
<Date> 20060426 </Date>
<Time> 120000 </Time>
<Subject> test </Subject>
<Description> testttt </Description>
<Place> paris </Place>
<Modtime> 182204 </Modtime>
</Appointment>
<Appointment>
<Id> 8 </Id>
<Date> 20060426 </Date>
<Time> 120000 </Time>
<Subject> whatever </Subject>
<Description> whateverrr </Description>
<Place> where ever </Place>
<Modtime> 182204 </Modtime>
</Appointment>
</agenda>
In reference to above xml, I need to write an code in C# to compare them. Here are some points to refer:
1. The first xml(source.xml) has 4 elements which I need to compare with the actual.xml.
2. if all the four element tags and their values match then the code should return success.
3.I have to first search the particular xml(source.xml) in the actualxml and then start comparing.apath will be useful to traverse to that particular node.
4.The search for the part xml will be done only on id value tag. that is the unique one.
Can anybody provide me some code to solve this......
It is urgent... I am not that good in C# coding and i am learning so sample code will be very helpful.
Regards....
Girija Shankar
View the full article
Source XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Appointment>
<Id> 8 </Id>
<Date> 20060426 </Date>
<Subject> whatever </Subject>
<Place> where ever </Place>
<Modtime> 182204 </Modtime>
</Appointment>
Actual XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<agenda>
<appointment>
<Id> 7 </Id>
<Date> 20060426 </Date>
<Time> 120000 </Time>
<Subject> test </Subject>
<Description> testttt </Description>
<Place> paris </Place>
<Modtime> 182204 </Modtime>
</Appointment>
<Appointment>
<Id> 8 </Id>
<Date> 20060426 </Date>
<Time> 120000 </Time>
<Subject> whatever </Subject>
<Description> whateverrr </Description>
<Place> where ever </Place>
<Modtime> 182204 </Modtime>
</Appointment>
</agenda>
In reference to above xml, I need to write an code in C# to compare them. Here are some points to refer:
1. The first xml(source.xml) has 4 elements which I need to compare with the actual.xml.
2. if all the four element tags and their values match then the code should return success.
3.I have to first search the particular xml(source.xml) in the actualxml and then start comparing.apath will be useful to traverse to that particular node.
4.The search for the part xml will be done only on id value tag. that is the unique one.
Can anybody provide me some code to solve this......
It is urgent... I am not that good in C# coding and i am learning so sample code will be very helpful.
Regards....
Girija Shankar
View the full article