i am performing xml merge of two xml files. xmlSrc will be merged into xmlDest
Code looks like
def xmlSrc = new XmlSlurper(false,false).parse(srcFile)
def xmlDest = new XmlSlurper(false,false).parse(destFile)
xmlSrc.children().each{
if(xmlDest.children().contains(it) == false){
log "Merging entry ${groovy.xml.XmlUtil.serialize(it)}"
xmlDest << it
}else{
log "not merging: ${groovy.xml.XmlUtil.serialize(it)}"
}
}
Src XML looks like:
<?xml version = '1.0' encoding = 'UTF-8'?>
<MetadataDirectory xmlns="http://xmlns.oracle.com/adfm/metainf" version="11.1.1.0.0">
<BusinessComponentProjectRegistry path="val1"/>
</MetadataDirectory>
Dest looks like
<?xml version = '1.0' encoding = 'UTF-8'?>
<MetadataDirectory xmlns="http://xmlns.oracle.com/adfm/metainf" version="11.1.1.0.0">
<BusinessComponentProjectRegistry path="val2"/>
</MetadataDirectory>
I am expecting my code to not find a match while merge and insert the node. However, it's always returning true.