Hello Mohsen,
I don't know how to do what you suggest.
But recently, when comparing objects and hashes, I've been just comparing the values I want to compare. So in rspec, I've been using include() rather than eq()
1. you may be able to use nokogiri and read the record and only compare the fields that interest you.
2. you can take the new data, and gsub(/<id>\d*<\/id>/,"") to get rid of the id field all together.
3. think about using external ids instead of internal ids. So instead of using your id, use a tag field as the externally facing unique id.
Best of luck,
Keenan