compare 2 xml files with csharp

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2006
Posts: 31
Reputation: Yustme is an unknown quantity at this point 
Solved Threads: 0
Yustme Yustme is offline Offline
Light Poster

Re: compare 2 xml files with csharp

 
0
  #11
May 27th, 2006
Originally Posted by plazmo
sure just look at the rows itemarray and check what has changed

like do this after you find a matching id:
for(int i=0;i<pcRow.ItemArray.Length;i++){
if(pcRow.ItemArray[i] != serverRow.ItemArray[i])
{then this item is different in this column of the row}
}

If i found the item which is different from the pcXML doc, how can i make it copy or clone to from serverXML to pcXML?

I tried this:

serverRow.ItemArray.Clone(outputXML);

its correct code, no errors, but it doesnt work. I have no idea how its possible to clone from file to file.

Also i keep seeing this in the console when i execute this program:

'Collection was modified; enumeration operation might not execute'

What does that mean?

Thanks in advance!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 206
Reputation: plazmo is an unknown quantity at this point 
Solved Threads: 16
plazmo's Avatar
plazmo plazmo is offline Offline
Posting Whiz in Training

Re: compare 2 xml files with csharp

 
0
  #12
May 27th, 2006
look at what i did to copy a different row!
  1. DataRow newRow = outputXML.Tables[0].NewRow(); //make a new row with the tables scheme
  2. newRow.ItemArray = pcRow.ItemArray; //copy over the contents of the row
  3. outputXML.Tables[0].Rows.Add(newRow);

you make a row object with the same shceme as the table then copy to source itemarray to the new row, then append the row to the talbe
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 31
Reputation: Yustme is an unknown quantity at this point 
Solved Threads: 0
Yustme Yustme is offline Offline
Light Poster

Re: compare 2 xml files with csharp

 
0
  #13
May 27th, 2006
Originally Posted by plazmo
look at what i did to copy a different row!
  1. DataRow newRow = outputXML.Tables[0].NewRow(); //make a new row with the tables scheme
  2. newRow.ItemArray = pcRow.ItemArray; //copy over the contents of the row
  3. outputXML.Tables[0].Rows.Add(newRow);

you make a row object with the same shceme as the table then copy to source itemarray to the new row, then append the row to the talbe

Oh ofcourse, stupid me. Im sorry, its just that i worked on this for like a week fulltime.

I can't think straight anymore :eek:

Thanks plazmo
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC