From: Sri on
Hi,

I have the below xml file. The requirement is:

1) Comparing this xml with another version of xml.
2) Removing some tags like <title>, <headline>, <credit>,

<codes class="IDS:ITEMID">
<code code="USN:TRE55A000" />
</codes>
<codes class="IDS:PROFILENAME">
<code code="SNI-Text" />
</codes>
<codes class="IDS:PROFILEVERSION">
<code code="00.00.01" />
</codes>

etc without any conditions.

3) After removal, comparing 2 xmls, if the data is same discard it ;
retain only differences. I.e, if the data is same between the two
xmls, it should not show and should be reported only if they are
different.

Please help me.


<?xml version="1.0" encoding="utf-8"?>
<newsitem itemid="TRE55A000" publisher="reuters.com" xml:lang="en-US"
parts="1" revision="1">
<title>Story 1</title>
<headline>Story 1</headline>
<copyright xml:lang="en-GB">© 2009 Thomson Reuters. All rights
reserved. Reuters content is the intellectual property of Thomson
Reuters or its third party content providers. Any copying,
republication or redistribution of Reuters content, including by
framing or similar means, is expressly prohibited without the prior
written consent of Thomson Reuters. Thomson Reuters shall not be
liable for any errors or delays in content, or for any actions taken
in reliance thereon. "Reuters" and the Reuters Logo are trademarks of
Thomson Reuters and its affiliated companies. For additional
information on other Reuters media services please visit
http://about.reuters.com/media/.</copyright>
<credit>Reuters</credit>
<caption>US-STORY-1:Story 1</caption>
<newsitempart role="MAIN">
<newsobject mimetype="text/x-newstext" mediatype="text">
<text>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Suspendisse iaculis posuere metus, at convallis urna pellentesque
non.</p>
<p>Phasellus sit amet metus odio. Praesent sed neque tellus.
Duis molestie risus sed arcu ullamcorper eu auctor dolor ultrices.</p>
</text>
</newsobject>
</newsitempart>
<metadata>
<codes class="IDS:ITEMID">
<code code="USN:TRE55A000" />
</codes>
<codes class="IDS:PROFILENAME">
<code code="SNI-Text" />
</codes>
<codes class="IDS:PROFILEVERSION">
<code code="00.00.01" />
</codes>
<codes class="TP:ID">
<code code="RTROPT" />
</codes>
<codes class="IDS:DTDINFO">
<code code="RTRSNewsML DTD, includes rtrsnewsml.metadata.dtd,
rtrsnewsml.handling.dtd, rtrsnewsml.dc.dtd" />
</codes>
<codes class="IDS:FILENAME">
<code />
</codes>
<codes class="IDS:MEDIATYPE">
<code code="TEXT" />
</codes>
<codes class="IIM:DATETIMECREATED">
<code />
</codes>
<codes class="IIM:LANGUAGE">
<code code="en-US" />
</codes>
<codes class="IIM:EDITSTATUS">
<code code="REUTERS" />
</codes>
<codes class="IIM:SPECIALINSTRUCTIONS">
<code code="New Story" />
</codes>
<codes class="IIM:CATEGORY">
<code code="A" />
</codes>
<codes class="TP:TOPICCODES">
<code code="OLRTXT" />
</codes>
<codes class="IIM:SUPPLEMENTALCATEGORY">
<code code="OLRTXT" />
</codes>
<codes class="TP:GENITEMS">
<code code="TP:GENIPTCSUBJECTREFERENCES" />
</codes>
<codes class="TP:GENIPTCSUBJECTREFERENCES">
<code code="TP:TOPICCODES" />
</codes>
<codes class="IDS:NEWSMLDUID">
<code />
</codes>
<codes class="IDS:NEWSMLDUIDBASE">
<code />
</codes>
<codes class="REL:DERIVATION-ITEMMOD">
<code code="USN:TRE55A001" />
</codes>
<dc element="dc.date.created" />
<dc element="dc.date.published" />
<dc element="dc.creator.location.city" value="Toronto" />
<dc element="dc.creator.location.country.code" value="CAN" />
<dc element="dc.creator.location.country.name" value="Canada" />
<dc element="dc.creator.program" value="Hermes v.2.1.0.184" />
</metadata>
<handling>
<routing>OGBTA</routing>
<service>RTR_TNS</service>
<product>TXT</product>
<priority>4</priority>
<slug>US-STORY-1</slug>
</handling>
</newsitem>