Compare Two XML Files Using .Net


Many cases we need to validate staging and production data. Mostly the client have send only XML files(production) and we have to validate our end output(staging).In this tool, we Validate the schema and compare the datas.

How to start?
  1. Change the config settings ( refer app.config in the attachment ).
  2. Set any primarykey is avail for each element ( in app.config - if new create one appsettings , its automatically get from the process)
  3. Finally the log will bind into the server.( refer errorpath and find out the result )
  4. Initially its validated Schemas.
  5. Once schema validated, compare both datas are equal.
  6. This process will done by using dataset.
Primary Key:

Uniquekey is used to map two files.So You have to add elements in app.config file dynamically based on your requirements.

<add key="TECH" value="ID"/>
<add key="Positions" value="PID"/>

Here "key" refers table name and "value" as column name.


Through dataset we validated and compare the xmlfiles.Its more powerful to validate easily from XML to dataset. In code comments we ellobrate all the functionlity levels clearly.