AnsweredAssumed Answered

how to eliminate duplicate records from an XML file without transforming it to flat file? is there any scripting

Question asked by shazia.karmala912634 on Feb 22, 2018
Latest reply on Feb 23, 2018 by leif_jacobsen

As per the below , two word elements has same name, so 1 duplicate node to be eliminated.

my xml input which i passed in message:

<?xml version="1.0"?>
<dictionary>
<word acronym="true">
<name>XML1</name>
<definition reference="Herong&apos;s Notes">xml1
Language.</definition>
<update date="2002-12-28"/>
</word>
<word acronym="true">
<name>XML2</name>
<definition reference="Herong&apos;s Notes">eXtensible Markup
Language.</definition>
<update date="2002-12-24"/>
</word> <word acronym="true">
<name>XML2</name>
<definition reference="Herong&apos;s Notes">eXtensible Markup
Language.</definition>
<update date="2002-12-24"/>
</word> <word acronym="true">
<name>XML3</name>
<definition reference="Herong&apos;s Notes">eXtensiblez Markup
Language.</definition>
<update date="2002-12-26"/>
</word>
</dictionary>

 

I have sorted the records based on <update date> field using the attached groovy script (PFA) & it works fine. but the requirement is sorted data should not have duplicates as well. to eliminate it is their any groovy script or  regular expression?

 

please help!

Attachments

Outcomes