Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XMLFormatter output is appending both input files

kndm opened this issue · comments

commented

Unsure if this is a bug or intended, but it definitely seems like the former.
Output presented is after running xmldiff -f xml with pretty print on, instead of generating the output needed to only change the left file, it is also including the whole data of the right file (and even adding diff markers to it)

Input 1:

<result xmlns:iati-extra="http://datastore.iatistandard.org/ns">
    <iati-activity iati-extra:version="2.03" xml:lang="en" default-currency="CHF" last-updated-datetime="2019-03-11T00:00:00Z">
      <iati-identifier>CH-4-2008004812</iati-identifier>
      <reporting-org ref="CH-4" type="10">
         <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
      </reporting-org>
      <title>
         <narrative>OCHA Humanitarian Response Fund</narrative>
      </title>
      <description type="1">
         <narrative>No description for this activity available at this point. Description indisponible pour cette activité.</narrative>
      </description>
      <participating-org ref="CH-4" role="1" type="10">
         <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
      </participating-org>
      <participating-org ref="XM-DAC-41114" role="4" type="40">
         <narrative>Programme des Nations Unies pour le développement</narrative>
      </participating-org>
      <other-identifier ref="7F-06559.13.01" type="A1"/>
      <activity-status code="2"/>
      <activity-date iso-date="2018-03-15" type="1"/>
      <activity-date iso-date="2018-03-15" type="2"/>
      <activity-date iso-date="2018-12-31" type="3"/>
      <activity-date iso-date="2018-12-31" type="4"/>
      <contact-info type="1">
         <organisation>
            <narrative>Swiss Agency for Development and Cooperation SDC</narrative>
         </organisation>
         <department>
            <narrative>Statistics Unit</narrative>
         </department>
         <telephone>+41 58 464 92 35</telephone>
         <email>stats.sdc@eda.admin.ch</email>
         <website>http://www.sdc.admin.ch</website>
         <mailing-address>
            <narrative>Freiburgstrasse 130, 3003 Berne</narrative>
         </mailing-address>
      </contact-info>
      <recipient-country code="SO">
         <narrative>Somalie</narrative>
      </recipient-country>
      <sector vocabulary="1" code="72010" percentage="20"/>
      <sector vocabulary="1" code="72050" percentage="30"/>
      <sector vocabulary="1" code="72040" percentage="50"/>
      <policy-marker code="6" significance="0">
         <narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Mitigation</narrative>
      </policy-marker>
      <policy-marker code="8" significance="0">
         <narrative>Aid Targeting the Objectives of the Convention to Combat Desertification</narrative>
      </policy-marker>
      <policy-marker code="7" significance="0">
         <narrative> Aid Targeting the Objectives of the Framework Convention on Climate Change - Adaptation </narrative>
      </policy-marker>
      <policy-marker code="2" significance="0">
         <narrative>Aid to Environment</narrative>
      </policy-marker>
      <policy-marker code="5" significance="0">
         <narrative>Aid Targeting the Objectives of the Convention on Biological Diversity</narrative>
      </policy-marker>
      <policy-marker code="9" significance="0">
         <narrative> Reproductive, Maternal, Newborn and Child Health (RMNCH)</narrative>
      </policy-marker>
      <collaboration-type code="1"/>
      <default-flow-type code="10"/>
      <default-finance-type code="110"/>
      <default-aid-type code="B03" vocabulary="1"/>
      <default-tied-status code="5"/>
      <transaction ref="7F-06559.13.01">
         <transaction-type code="2"/>
         <transaction-date iso-date="2018-12-15"/>
         <value currency="CHF" value-date="2018-12-15">1000000</value>
         <description>
            <narrative> Outgoing Commitment </narrative>
         </description>
         
      </transaction>
      <transaction ref="7F-06559.13.01">
         <transaction-type code="3"/>
         <transaction-date iso-date="2018-12-15"/>
         <value currency="CHF" value-date="2018-12-15">1000000</value>
         <description>
            <narrative> Disbursement</narrative>
         </description>
         
      </transaction>
      <conditions attached="0"/>
   </iati-activity>
</result>

Input 2:

<result xmlns:iati-extra="http://datastore.iatistandard.org/ns">  
  <iati-activity>
    <iati-identifier>CH-4-2008004812</iati-identifier>
    <reporting-org ref="CH-4" type="10" secondary-reporter="0">
      <narrative>Switzerland - Swiss Agency for Development and Cooperation (SDC)</narrative>
    </reporting-org>
    <title>
      <narrative>OCHA Humanitarian Response Fund</narrative>
    </title>
    <description type="1">
      <narrative>No description for this activity available at this point. Description indisponible pour cette activité.</narrative>
    </description>
    <participating-org ref="CH-4" type="10" role="1">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </participating-org>
    <participating-org ref="XM-DAC-41114" type="40" role="4">
      <narrative>Programme des Nations Unies pour le développement</narrative>
    </participating-org>
    <other-identifier ref="7F-06559.13.01" type="A1">
      <owner-org/>
    </other-identifier>
    <activity-status code="2"/>
    <activity-date iso-date="2018-03-15" type="1"/>
    <activity-date iso-date="2018-03-15" type="2"/>
    <activity-date iso-date="2018-12-31" type="3"/>
    <activity-date iso-date="2018-12-31" type="4"/>
    <contact-info type="1">
      <organisation>
        <narrative>Swiss Agency for Development and Cooperation SDC</narrative>
      </organisation>
      <department>
        <narrative>Statistics Unit</narrative>
      </department>
      <telephone>+41 58 464 92 35</telephone>
      <email>stats.sdc@eda.admin.ch</email>
      <website>http://www.sdc.admin.ch</website>
      <mailing-address>
        <narrative>Freiburgstrasse 130, 3003 Berne</narrative>
      </mailing-address>
    </contact-info>
    <recipient-country code="SO"/>
    <sector code="72010" vocabulary="1" percentage="20.00"/>
    <sector code="72050" vocabulary="1" percentage="30.00"/>
    <sector code="72040" vocabulary="1" percentage="50.00"/>
    <policy-marker vocabulary="1" code="6" significance="0">
      <narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Mitigation</narrative>
    </policy-marker>
    <policy-marker vocabulary="1" code="8" significance="0">
      <narrative>Aid Targeting the Objectives of the Convention to Combat Desertification</narrative>
    </policy-marker>
    <policy-marker vocabulary="1" code="7" significance="0">
      <narrative> Aid Targeting the Objectives of the Framework Convention on Climate Change - Adaptation </narrative>
    </policy-marker>
    <policy-marker vocabulary="1" code="2" significance="0">
      <narrative>Aid to Environment</narrative>
    </policy-marker>
    <policy-marker vocabulary="1" code="5" significance="0">
      <narrative>Aid Targeting the Objectives of the Convention on Biological Diversity</narrative>
    </policy-marker>
    <policy-marker vocabulary="1" code="9" significance="0">
      <narrative> Reproductive, Maternal, Newborn and Child Health (RMNCH)</narrative>
    </policy-marker>
    <collaboration-type code="1"/>
    <default-flow-type code="10"/>
    <default-finance-type code="110"/>
    <default-tied-status code="5"/>
    <transaction ref="7F-06559.13.01">
      <transaction-type code="2"/>
      <transaction-date iso-date="2018-12-15"/>
      <value currency="CHF" value-date="2018-12-15">1000000.00</value>
      <description>
        <narrative> Outgoing Commitment </narrative>
      </description>
      <sector code="72040" vocabulary="1"/>
      <sector code="72050" vocabulary="1"/>
      <sector code="72010" vocabulary="1"/>
      <recipient-country code="SO"/>
      <flow-type code="10"/>
      <finance-type code="110"/>
      <tied-status code="5"/>
    </transaction>
    <transaction ref="7F-06559.13.01">
      <transaction-type code="3"/>
      <transaction-date iso-date="2018-12-15"/>
      <value currency="CHF" value-date="2018-12-15">1000000.00</value>
      <description>
        <narrative> Disbursement</narrative>
      </description>
      <sector code="72040" vocabulary="1"/>
      <sector code="72050" vocabulary="1"/>
      <sector code="72010" vocabulary="1"/>
      <recipient-country code="SO"/>
      <flow-type code="10"/>
      <finance-type code="110"/>
      <tied-status code="5"/>
    </transaction>
    <conditions attached="0"/>
  </iati-activity>
</result>

Output:

<result xmlns:iati-extra="http://datastore.iatistandard.org/ns" xmlns:diff="http://namespaces.shoobx.com/diff">
  <iati-activity diff:insert="">
    <iati-identifier diff:insert="">CH-4-2008004812</iati-identifier>
    <reporting-org diff:insert="" diff:rename="organisation" ref="CH-4" diff:add-attr="ref;secondary-reporter;type" secondary-reporter="0" type="10">
      <narrative><span style="DiffInsert">Switzerland - </span>Swiss Agency for Development and Cooperation <span style="DiffInsert">(</span>SDC<span style="DiffInsert">)</span></narrative>
    </reporting-org>
    <title diff:insert="">
      <narrative>OCHA Humanitarian Response Fund</narrative>
    </title>
    <description type="1" diff:insert="">
      <narrative>No description for this activity available at this point. Description indisponible pour cette activité.</narrative>
    </description>
    <participating-org ref="CH-4" type="10" diff:insert="" diff:rename="reporting-org" role="1" diff:add-attr="role">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </participating-org>
    <participating-org ref="XM-DAC-41114" role="4" type="40" diff:insert="">
      <narrative>Programme des Nations Unies pour le développement</narrative>
    </participating-org>
    <other-identifier diff:insert="" ref="7F-06559.13.01" diff:add-attr="ref;type" type="A1">
      <owner-org diff:insert=""/>
    </other-identifier>
    <activity-status code="2" diff:insert=""/>
    <activity-date type="1" diff:insert="" diff:rename="other-identifier" diff:update-attr="type:A1" iso-date="2018-03-15" diff:add-attr="iso-date" diff:delete-attr="ref"/>
    <activity-date iso-date="2018-03-15" type="2" diff:insert="" diff:update-attr="type:1"/>
    <activity-date iso-date="2018-12-31" type="3" diff:insert="" diff:update-attr="iso-date:2018-03-15;type:2"/>
    <activity-date iso-date="2018-12-31" type="4" diff:insert="" diff:update-attr="type:3"/>
    <contact-info type="1" diff:insert="">
      <organisation diff:delete="">
        <narrative>Swiss Agency for Development and Cooperation SDC</narrative>
      </organisation>
      <organisation diff:insert="" diff:rename="participating-org" diff:delete-attr="ref;role;type">
        <narrative>Swiss Agency for Development and Cooperation <span style="DiffDelete"><strike>(</strike></span>SDC<span style="DiffDelete"><strike>)</strike></span></narrative>
      </organisation>
      <department>
        <narrative>Statistics Unit</narrative>
      </department>
      <telephone>+41 58 464 92 35</telephone>
      <email>stats.sdc@eda.admin.ch</email>
      <website>http://www.sdc.admin.ch</website>
      <mailing-address>
        <narrative>Freiburgstrasse 130, 3003 Berne</narrative>
      </mailing-address>
    </contact-info>
    <recipient-country code="SO" diff:insert="">
      <narrative diff:delete="">Somalie</narrative>
    </recipient-country>
    <sector vocabulary="1" code="72010" percentage="20.00" diff:insert="" diff:update-attr="percentage:20"/>
    <sector vocabulary="1" code="72050" percentage="30.00" diff:insert="" diff:update-attr="percentage:30"/>
    <sector vocabulary="1" code="72040" percentage="50.00" diff:insert="" diff:update-attr="percentage:50"/>
    <policy-marker code="6" significance="0" diff:insert="" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Mitigation</narrative>
    </policy-marker>
    <policy-marker code="8" significance="0" diff:insert="" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid Targeting the Objectives of the Convention to Combat Desertification</narrative>
    </policy-marker>
    <policy-marker code="7" significance="0" diff:insert="" vocabulary="1" diff:add-attr="vocabulary">
      <narrative> Aid Targeting the Objectives of the Framework Convention on Climate Change - Adaptation </narrative>
    </policy-marker>
    <policy-marker code="2" significance="0" diff:insert="" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid to Environment</narrative>
    </policy-marker>
    <policy-marker code="5" significance="0" diff:insert="" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid Targeting the Objectives of the Convention on Biological Diversity</narrative>
    </policy-marker>
    <policy-marker code="9" significance="0" diff:insert="" vocabulary="1" diff:add-attr="vocabulary">
      <narrative> Reproductive, Maternal, Newborn and Child Health (RMNCH)</narrative>
    </policy-marker>
    <collaboration-type code="1" diff:insert=""/>
    <default-flow-type code="10" diff:insert=""/>
    <default-finance-type code="110" diff:insert=""/>
    <default-tied-status code="5" diff:insert=""/>
    <transaction ref="7F-06559.13.01" diff:insert="">
      <transaction-type code="2"/>
      <transaction-date iso-date="2018-12-15" diff:insert="" diff:rename="activity-date" diff:update-attr="iso-date:2018-12-31" diff:delete-attr="type"/>
      <transaction-date iso-date="2018-12-15" diff:delete=""/>
      <value currency="CHF" value-date="2018-12-15">1000000<span style="DiffInsert">.00</span></value>
      <description>
        <narrative> Outgoing Commitment </narrative>
      </description>
      <sector code="72040" vocabulary="1" diff:insert="" diff:rename="default-aid-type" diff:update-attr="code:B03"/>
      <sector diff:insert="" code="72050" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <sector diff:insert="" code="72010" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <recipient-country diff:insert="" code="SO" diff:add-attr="code"/>
      <flow-type diff:insert="" code="10" diff:add-attr="code"/>
      <finance-type diff:insert="" diff:rename="transaction-date" code="110" diff:add-attr="code" diff:delete-attr="iso-date"/>
      <tied-status diff:insert="" code="5" diff:add-attr="code"/>
    </transaction>
    <transaction ref="7F-06559.13.01" diff:insert="">
      <transaction-type code="3"/>
      <transaction-date iso-date="2018-12-15" diff:delete=""/>
      <transaction-date iso-date="2018-12-15" diff:insert=""/>
      <value currency="CHF" value-date="2018-12-15">1000000<span style="DiffInsert">.00</span></value>
      <description>
        <narrative> Disbursement</narrative>
      </description>
      <sector diff:insert="" code="72040" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <sector diff:insert="" code="72050" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <sector diff:insert="" code="72010" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <recipient-country diff:insert="" code="SO" diff:add-attr="code"/>
      <flow-type diff:insert="" code="10" diff:add-attr="code"/>
      <finance-type diff:insert="" code="110" diff:add-attr="code"/>
      <tied-status diff:insert="" code="5" diff:add-attr="code"/>
    </transaction>
    <conditions attached="0" diff:insert=""/>
  </iati-activity>
  <iati-activity iati-extra:version="2.03" xml:lang="en" default-currency="CHF" last-updated-datetime="2019-03-11T00:00:00Z" diff:delete="">
    <iati-identifier diff:delete="">CH-4-2008004812</iati-identifier>
    <reporting-org ref="CH-4" type="10" diff:delete="">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </reporting-org>
    <title diff:delete="">
      <narrative>OCHA Humanitarian Response Fund</narrative>
    </title>
    <description type="1" diff:delete="">
      <narrative>No description for this activity available at this point. Description indisponible pour cette activité.</narrative>
    </description>
    <participating-org ref="CH-4" role="1" type="10" diff:delete="">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </participating-org>
    <participating-org ref="XM-DAC-41114" role="4" type="40" diff:delete="">
      <narrative>Programme des Nations Unies pour le développement</narrative>
    </participating-org>
    <other-identifier ref="7F-06559.13.01" type="A1" diff:delete=""/>
    <activity-status code="2" diff:delete=""/>
    <activity-date iso-date="2018-03-15" type="1" diff:delete=""/>
    <activity-date iso-date="2018-03-15" type="2" diff:delete=""/>
    <activity-date iso-date="2018-12-31" type="3" diff:delete=""/>
    <activity-date iso-date="2018-12-31" type="4" diff:delete=""/>
    <contact-info type="1" diff:delete="">
      <organisation diff:delete="">
        <narrative>Swiss Agency for Development and Cooperation SDC</narrative>
      </organisation>
      <department>
        <narrative>Statistics Unit</narrative>
      </department>
      <telephone>+41 58 464 92 35</telephone>
      <email>stats.sdc@eda.admin.ch</email>
      <website>http://www.sdc.admin.ch</website>
      <mailing-address>
        <narrative>Freiburgstrasse 130, 3003 Berne</narrative>
      </mailing-address>
    </contact-info>
    <recipient-country code="SO" diff:delete="">
      <narrative>Somalie</narrative>
    </recipient-country>
    <sector vocabulary="1" code="72010" percentage="20" diff:delete=""/>
    <sector vocabulary="1" code="72050" percentage="30" diff:delete=""/>
    <sector vocabulary="1" code="72040" percentage="50" diff:delete=""/>
    <policy-marker code="6" significance="0" diff:delete="">
      <narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Mitigation</narrative>
    </policy-marker>
    <policy-marker code="8" significance="0" diff:delete="">
      <narrative>Aid Targeting the Objectives of the Convention to Combat Desertification</narrative>
    </policy-marker>
    <policy-marker code="7" significance="0" diff:delete="">
      <narrative> Aid Targeting the Objectives of the Framework Convention on Climate Change - Adaptation </narrative>
    </policy-marker>
    <policy-marker code="2" significance="0" diff:delete="">
      <narrative>Aid to Environment</narrative>
    </policy-marker>
    <policy-marker code="5" significance="0" diff:delete="">
      <narrative>Aid Targeting the Objectives of the Convention on Biological Diversity</narrative>
    </policy-marker>
    <policy-marker code="9" significance="0" diff:delete="">
      <narrative> Reproductive, Maternal, Newborn and Child Health (RMNCH)</narrative>
    </policy-marker>
    <collaboration-type code="1" diff:delete=""/>
    <default-flow-type code="10" diff:delete=""/>
    <default-finance-type code="110" diff:delete=""/>
    <default-aid-type code="B03" vocabulary="1" diff:delete=""/>
    <default-tied-status code="5" diff:delete=""/>
    <transaction ref="7F-06559.13.01" diff:delete="">
      <transaction-type code="2"/>
      <transaction-date iso-date="2018-12-15"/>
      <value currency="CHF" value-date="2018-12-15">1000000</value>
      <description>
        <narrative> Outgoing Commitment </narrative>
      </description>
    </transaction>
    <transaction ref="7F-06559.13.01" diff:delete="">
      <transaction-type code="3"/>
      <transaction-date iso-date="2018-12-15"/>
      <value currency="CHF" value-date="2018-12-15">1000000</value>
      <description>
        <narrative> Disbursement</narrative>
      </description>
    </transaction>
    <conditions attached="0" diff:delete=""/>
  </iati-activity>
</result>

There seems to be a few diff-inserts that aren't warranted there, I'll try to get time to look into that.

@regebro could you tell me why I'm getting the xml diffs like this? I just changed the attribute on one node - https://pastebin.com/vBgzZYXj

I don't want to create an unnecessary issue

I have to go through the file and see how it maps and how nodes compare and things like that. It takes time, which is why I haven't done it yet. But I'll get to it, I promise. Node comparison can certainly be improved.

@kndm So, looking more closely, the big problem is that the files simply are so different that the matching algorithm doesn't find any match, as almost every level is full of differences, like percentages being integers in one file and decimals in one, and titles being different, etc.
So it deletes almost all the content and inserts new content.

You can solve this with the -F parameter, that lowers the requirement for how similar a node needs to be to be counted as a match.

Hence, xmldiff file1.xml file2.xml -f xml -F 0.4 results in this output:

<result xmlns:diff="http://namespaces.shoobx.com/diff">
  <iati-activity diff:delete-attr="default-currency;last-updated-datetime;{http://datastore.iatistandard.org/ns}version;{http://www.w3.org/XML/1998/namespace}lang">
    <iati-identifier>CH-4-2008004812</iati-identifier>
    <reporting-org ref="CH-4" type="10" diff:delete="">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </reporting-org>
    <reporting-org diff:insert="" diff:rename="organisation" ref="CH-4" diff:add-attr="ref;secondary-reporter;type" secondary-reporter="0" type="10">
      <narrative><diff:insert>Switzerland - </diff:insert>Swiss Agency for Development and Cooperation <diff:insert>(</diff:insert>SDC<diff:insert>)</diff:insert></narrative>
    </reporting-org>
    <title>
      <narrative>OCHA Humanitarian Response Fund</narrative>
    </title>
    <description type="1">
      <narrative>No description for this activity available at this point. Description indisponible pour cette activite.</narrative>
    </description>
    <participating-org ref="CH-4" type="10" diff:insert="" diff:rename="reporting-org" role="1" diff:add-attr="role">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </participating-org>
    <participating-org ref="CH-4" role="1" type="10" diff:delete="">
      <narrative>Swiss Agency for Development and Cooperation (SDC)</narrative>
    </participating-org>
    <participating-org ref="XM-DAC-41114" role="4" type="40">
      <narrative>Programme des Nations Unies pour le developpement</narrative>
    </participating-org>
    <other-identifier ref="7F-06559.13.01" type="A1" diff:delete=""/>
    <other-identifier diff:insert="" ref="7F-06559.13.01" diff:add-attr="ref;type" type="A1">
      <owner-org diff:insert=""/>
    </other-identifier>
    <activity-status code="2"/>
    <activity-date type="1" diff:insert="" diff:rename="other-identifier" diff:update-attr="type:A1" iso-date="2018-03-15" diff:add-attr="iso-date" diff:delete-attr="ref"/>
    <activity-date iso-date="2018-03-15" type="2" diff:update-attr="type:1"/>
    <activity-date iso-date="2018-12-31" type="3" diff:update-attr="iso-date:2018-03-15;type:2"/>
    <activity-date iso-date="2018-12-31" type="4" diff:update-attr="type:3"/>
    <activity-date iso-date="2018-12-31" type="4" diff:delete=""/>
    <contact-info type="1">
      <organisation diff:delete="">
        <narrative>Swiss Agency for Development and Cooperation SDC</narrative>
      </organisation>
      <organisation diff:insert="" diff:rename="participating-org" diff:delete-attr="ref;role;type">
        <narrative>Swiss Agency for Development and Cooperation <diff:delete>(</diff:delete>SDC<diff:delete>)</diff:delete></narrative>
      </organisation>
      <department>
        <narrative>Statistics Unit</narrative>
      </department>
      <telephone>+41 58 464 92 35</telephone>
      <email>stats.sdc@eda.admin.ch</email>
      <website>http://www.sdc.admin.ch</website>
      <mailing-address>
        <narrative>Freiburgstrasse 130, 3003 Berne</narrative>
      </mailing-address>
    </contact-info>
    <recipient-country code="SO">
      <narrative diff:delete="">Somalie</narrative>
    </recipient-country>
    <sector vocabulary="1" code="72010" percentage="20.00" diff:update-attr="percentage:20"/>
    <sector vocabulary="1" code="72050" percentage="30.00" diff:update-attr="percentage:30"/>
    <sector vocabulary="1" code="72040" percentage="50.00" diff:update-attr="percentage:50"/>
    <policy-marker code="6" significance="0" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Mitigation</narrative>
    </policy-marker>
    <policy-marker code="8" significance="0" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid Targeting the Objectives of the Convention to Combat Desertification</narrative>
    </policy-marker>
    <policy-marker code="7" significance="0" vocabulary="1" diff:add-attr="vocabulary">
      <narrative> Aid Targeting the Objectives of the Framework Convention on Climate Change - Adaptation </narrative>
    </policy-marker>
    <policy-marker code="2" significance="0" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid to Environment</narrative>
    </policy-marker>
    <policy-marker code="5" significance="0" vocabulary="1" diff:add-attr="vocabulary">
      <narrative>Aid Targeting the Objectives of the Convention on Biological Diversity</narrative>
    </policy-marker>
    <policy-marker code="9" significance="0" vocabulary="1" diff:add-attr="vocabulary">
      <narrative> Reproductive, Maternal, Newborn and Child Health (RMNCH)</narrative>
    </policy-marker>
    <collaboration-type code="1"/>
    <default-flow-type code="10"/>
    <default-finance-type code="110"/>
    <default-aid-type code="B03" vocabulary="1" diff:delete=""/>
    <default-tied-status code="5"/>
    <transaction ref="7F-06559.13.01">
      <transaction-type code="2"/>
      <transaction-date iso-date="2018-12-15" diff:insert="" diff:rename="activity-date" diff:update-attr="iso-date:2018-12-31" diff:delete-attr="type"/>
      <transaction-date iso-date="2018-12-15" diff:delete=""/>
      <value currency="CHF" value-date="2018-12-15">1000000<diff:insert>.00</diff:insert></value>
      <description>
        <narrative> Outgoing Commitment </narrative>
      </description>
      <sector code="72040" vocabulary="1" diff:insert="" diff:rename="default-aid-type" diff:update-attr="code:B03"/>
      <sector diff:insert="" code="72050" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <sector diff:insert="" code="72010" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <recipient-country diff:insert="" code="SO" diff:add-attr="code"/>
      <flow-type diff:insert="" code="10" diff:add-attr="code"/>
      <finance-type diff:insert="" diff:rename="transaction-date" code="110" diff:add-attr="code" diff:delete-attr="iso-date"/>
      <tied-status diff:insert="" code="5" diff:add-attr="code"/>
    </transaction>
    <transaction ref="7F-06559.13.01">
      <transaction-type code="3"/>
      <transaction-date iso-date="2018-12-15" diff:delete=""/>
      <transaction-date iso-date="2018-12-15" diff:insert=""/>
      <value currency="CHF" value-date="2018-12-15">1000000<diff:insert>.00</diff:insert></value>
      <description>
        <narrative> Disbursement</narrative>
      </description>
      <sector diff:insert="" code="72040" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <sector diff:insert="" code="72050" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <sector diff:insert="" code="72010" diff:add-attr="code;vocabulary" vocabulary="1"/>
      <recipient-country diff:insert="" code="SO" diff:add-attr="code"/>
      <flow-type diff:insert="" code="10" diff:add-attr="code"/>
      <finance-type diff:insert="" code="110" diff:add-attr="code"/>
      <tied-status diff:insert="" code="5" diff:add-attr="code"/>
    </transaction>
    <conditions attached="0"/>
  </iati-activity>
</result>
```

@Utkarsh1308 I suggest you reopen your question as a new issue, with the example XML included. This is an artefact of how the comparison is done, and something that can be improved.

Closing as lacking feedback.