Source:
public boolean compareTo(XmlElement otherNode, MergingReport.Builder mergingReport) { ILogger iLogger = mergingReport.getLogger(); if (mXml.getNamespaceURI() != null) { if (!mXml.getLocalName().equals(otherNode.mXml.getLocalName())) { iLogger.error(null ,"Elemnt names do not match: " + mXml.getLocalName() + " " + otherNode.mXml.getLocalName()); return false; } String thisNS = mXml.getNamespaceURI(); String otherNS = otherNode.mXml.getNamespaceURI(); if ((thisNS == null && otherNS != null) || (thisNS != null && !thisNS.equals(otherNS))) { iLogger.error(null , "Element namespaces names do not match: " + thisNS + " " + otherNS); return false; } } else { if (!mXml.getNodeName().equals(otherNode.mXml.getNodeName())) { iLogger.error(null , "Element names do not match: " + mXml.getNodeName() + " " + otherNode.mXml.getNodeName()); return false; } } if (!checkAttributes(this, otherNode, mergingReport)) { return false; } if (!checkAttributes(otherNode, this, mergingReport)) { return false; } List<Node> expectedChildren = filterUninterestingNodes(mXml.getChildNodes()); List<Node> actualChildren = filterUninterestingNodes(otherNode.mXml.getChildNodes()); if (expectedChildren.size() != actualChildren.size()) { String error = getId() + ": Number of children do not match up: " + expectedChildren.size() + " versus " + actualChildren.size() + " in " + otherNode.getId(); mergingReport.addError(error); return false; } for (Node expectedChild : expectedChildren) { if (expectedChild.getNodeType() == Node.ELEMENT_NODE) { XmlElement expectedChildNode = new XmlElement((Element) expectedChild, mDocument); if (!findAndCompareNode(actualChildren, expectedChildNode, mergingReport)) { return false; } } } return true; }

Target:
public boolean compareTo(XmlElement otherNode, MergingReport.Builder mergingReport) { ILogger iLogger = mergingReport.getLogger(); if (mXml.getNamespaceURI() != null) { if (!mXml.getLocalName().equals(otherNode.mXml.getLocalName())) { iLogger.error(null ,"Element names do not match: " + mXml.getLocalName() + " " + otherNode.mXml.getLocalName()); return false; } String thisNS = mXml.getNamespaceURI(); String otherNS = otherNode.mXml.getNamespaceURI(); if ((thisNS == null && otherNS != null) || (thisNS != null && !thisNS.equals(otherNS))) { iLogger.error(null , "Element namespaces names do not match: " + thisNS + " " + otherNS); return false; } } else { if (!mXml.getNodeName().equals(otherNode.mXml.getNodeName())) { iLogger.error(null , "Element names do not match: " + mXml.getNodeName() + " " + otherNode.mXml.getNodeName()); return false; } } if (!checkAttributes(this, otherNode, mergingReport)) { return false; } if (!checkAttributes(otherNode, this, mergingReport)) { return false; } List<Node> expectedChildren = filterUninterestingNodes(mXml.getChildNodes()); List<Node> actualChildren = filterUninterestingNodes(otherNode.mXml.getChildNodes()); if (expectedChildren.size() != actualChildren.size()) { String error = getId() + ": Number of children do not match up: " + expectedChildren.size() + " versus " + actualChildren.size() + " in " + otherNode.getId(); mergingReport.addError(error); return false; } for (Node expectedChild : expectedChildren) { if (expectedChild.getNodeType() == Node.ELEMENT_NODE) { XmlElement expectedChildNode = new XmlElement((Element) expectedChild, mDocument); if (!findAndCompareNode(actualChildren, expectedChildNode, mergingReport)) { return false; } } } return true; }